bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67310: [PATCH] Include the project--list as history when prompting f


From: Dmitry Gutov
Subject: bug#67310: [PATCH] Include the project--list as history when prompting for a project
Date: Sat, 25 Nov 2023 03:54:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

I'll try to answer some of the questions that are still relevant to the latest patch, myself.

On 23/11/2023 08:38, Eli Zaretskii wrote:

+            ;; Iterate in reverse order so project--name-history is in
+            ;; the correct order.

What is the "correct" order?

Their order in project--list.

Iteration and construction of a new list with 'push' leads to the reverse order, hence the use of reversion at the beginning to counteract that.

-              (if-let (proj (project--find-in-directory dir))
-                  (push (cons (project-name proj) proj) ret)))
+              (when-let (proj (project--find-in-directory dir))
+                (let ((name (project-name proj)))
+                  (push name project--name-history)
+                  (push (cons name proj) ret))))

Not sure I understand why you replaced if-let with when-let here.

To reduce the amount of indentation, perhaps.

+            (let ((history-add-new-input nil))

Why this non-standard way of let-binding a variable to nil?

I use this myself sometimes to make the change more explicit.

Anyway, amended.

+        (let ((history-delete-duplicates t)
+              (history-length t))
+          (add-to-history 'project--list root))

Why are you overriding the values of these two user options?

To implement the current behavior (how additions to project--list) happen. I've described that behavior in one of the earlier messages here.

-  (let ((dirs (if recursive
-                  (directory-files-recursively dir "" t)
-                (directory-files dir t)))
-        (known (make-hash-table :size (* 2 (length project--list))
-                                :test #'equal))
-        (count 0))
-    (dolist (project (mapcar #'car project--list))
+  (let* ((dirs (if recursive
+                   (directory-files-recursively dir "" t)
+                 (directory-files dir t)))
+         (roots (project-known-project-roots))
+         (known (make-hash-table :size (* 2 (length roots))
+                                 :test #'equal))
+         (count 0))

Is it really necessary to use let* here?

'known' depend on 'roots'.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]