GNU bug report logs - #67310
[PATCH] Include the project--list as history when prompting for a project

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Mon, 20 Nov 2023 19:59:02 UTC

Severity: wishlist

Tags: patch

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 67310 <at> debbugs.gnu.org, eliz <at> gnu.org, juri <at> linkov.net
Subject: bug#67310: [PATCH] Include the project--list as history when prompting for a project
Date: Thu, 23 Nov 2023 04:55:56 +0200
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).




This bug report was last modified 1 year and 156 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.