Subject: bug#62776: 30.0.50; 'project-find-file' ignoring 'file-name-history'

From: Dmitry Gutov <[email-masked]>
Date: Wed, 19 Apr 2023 04:54:28 +0300

On 19/04/2023 00:38, Rudolf Adamkovič wrote:
> Dmitry Gutov<[email-masked]>  writes:
> 
>> I also tried replacing the latter with 'M-x vertico-mode' just now, and
>> 'M-n' seemed to work fine there, suggesting the files visited previously
>> with the same command. Tested in both Emacs 29 and 30.
> To avoid miscommunication, I shall provide a precise recipe.
> 
> (And, I apologize for not providing a recipe sooner.)
> 
> REPRODUCTION STEPS:
> 
>    1. mv ~/.emacs.d ~/.emacs.d.OLD
>    2. navigate to some Git repository
>    3. emacs -Q
>    4. M-x package-refresh-contents RET
>    5. M-x package-install RET
>    6. M-x vertico RET
>    7. M-x vertico-mode RET
>    8. C-x p f <SOME-FILE-NAME> RET
>    9. C-x p f
> 
> EXPECTED RESULT:
> 
>    Vertico pops up, showing 10 candidates.  The first candidate is
>    <SOME-FILE-NAME>, the file that was opened most recently.
> 
> ACTUAL RESULTS:
> 
>    Vertico pops up, but the first candidate is not <SOME-FILE-NAME>.
> 
> NOTES:
> 
>    If I type M-x instead of C-x p f, Vertico pops up 10 most recently
>    used commands, such as 'package-refresh-contents' or 'package-install'
>    in this case.  All the other commands that have histories work the
>    same way, only C-x p f does not work that way (anymore, but it used
>    to).

Thanks!

If after step 9 I press M-p (previous-history-element), <SOME-FILE-NAME> 
relative to the repository root is inserted no problem. So it seems like 
the history var is used at least in some form.

But you're saying it is not used during sorting? And that used to happen?

It's possible that vertico--history-hash is confused by our manipulation 
of the history entries -- like how they are stored as absolute file 
names now (bug#58447).

Ideally this will require just some tiny tweak in vertico. I wonder what 
Daniel thinks.