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: Thu, 23 Nov 2023 04:55:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 23/11/2023 01:14, Spencer Baugh wrote:
@@ -1769,27 +1778,40 @@ project-prompt-project-dir
            ;; completion style).
            (project--file-completion-table
             (append project--list `(,dir-choice))))
+         (project--dir-history project--list)
           (pr-dir ""))
      (while (equal pr-dir "")
        ;; If the user simply pressed RET, do this again until they don't.
-      (setq pr-dir (completing-read "Select project: " choices nil t)))
+      (setq pr-dir
+            (let ((history-add-new-input nil))
+              (completing-read "Select project: " choices nil t nil 
'project--dir-history))))
      (if (equal pr-dir dir-choice)
          (read-directory-name "Select directory: " default-directory nil t)
+      (let q((history-delete-duplicates t)
              ^
               typo

+            (history-length t))
+        (add-to-history 'project--list pr-dir))
        pr-dir)))

Sorry, I thought we agreed that project-prompt-project-dir and project-prompt-project-name shouldn't add-to-history?

Because project-current calls project-remember-project already (including the cases when the prompter isn't used: when the project is auto-detected). And to cover the remaining cases, we can have project-switch-project call project-remember-project as well.

This way also we keep the project-prompter implementations with less logic inside, meaning it's a bit easier to write the next one.

More DRY, too. At least while there's no other code using project-prompter directly (but then we could add a helper).





reply via email to

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