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

From: Dmitry Gutov <[email-masked]>
Date: Sun, 10 Dec 2023 05:04:27 +0200

Hi Juri,

On 27/11/2023 19:10, Juri Linkov wrote:
>> +            ;; Iterate in reverse order so project--name-history is in
>> +            ;; the correct order.
>> +            (dolist (dir (reverse (project-known-project-roots)))
>>                 ;; we filter out directories that no longer map to a project,
>>                 ;; since they don't have a clean project-name.
>> -              (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))))
> This change broke the order of 'C-x p p M-n M-n ...',
> so I pushed this fix:
> 
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index f7f057396e1..a81bb63fba4 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -1808,7 +1808,7 @@ project-prompt-project-name
>                            (name (project-name proj)))
>                   (push name project--name-history)
>                   (push (cons name proj) ret)))
> -            ret))
> +            (reverse ret)))
>            ;; XXX: Just using this for the category (for the substring
>            ;; completion style).
>            (table (project--file-completion-table

Could you remind me which behavior in 'M-n M-n' the aforementioned 
change relates to? Is this supposed to be like input history as well, or 
the contents of the completions table in a certain order?

I just tried find-file, and the future history is empty there, so I 
suppose this is something we added particularly for project-find-file.