Subject: Re: bug#60359: 29.0.60; completion-auto-select set to t skips first argument when completing files

From: Gregory Heytings <[email-masked]>
Date: Tue, 27 Dec 2022 23:48:49 +0000

>
> If the user option 'completion-auto-select' is set to t, then pressing 
> tab should pop up the completions buffer and select the first option. 
> This works well, unless a file name is being completed.  In that case, 
> tab doesn't jump to completion buffer.  In fact it appears not to even 
> open it by default.  A second press opens the buffer, but only jumps if 
> you don't do anything else for about half a second.  A third press of 
> the tab key jumps to the second option.  So if you press tab three 
> times, without waiting, you always skip the first completion suggestion.
>
> The issue can be reproduced with emacs -Q, by evaluating (setq 
> completion-auto-select t) and then opening a file using C-x C-f, in 
> presumably any directory.
>

Thanks for your bug report.  If I set completion-auto-select in emacs -Q, 
C-x C-f C TAB (or TAB TAB, depending on the value of 
completion-auto-select) in the Emacs repository behaves as expected. 
However, C-x C-f src/ TAB does not.  Is the latter case what you have in 
mind, or do I misunderstand what you mean?  If not, the attached patch 
should fix that bug.
From c5430c403b05008cd67f8786571a2fd63402231f Mon Sep 17 00:00:00 2001
From: Gregory Heytings <[email-masked]>
Date: Tue, 27 Dec 2022 23:40:25 +0000
Subject: [PATCH] Fix completion when completion-auto-select is set

* lisp/minibuffer.el (completion--do-completion): Do not display
"Complete, but not unique" messages when completion-auto-select is
set.  Fixes bug#60359.
---
 lisp/minibuffer.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 6e42296e7ba..5077e6c7e96 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1474,7 +1474,8 @@ completion--do-completion
               (if (and (eq this-command last-command) completion-auto-help)
                   (minibuffer-completion-help beg end))
               (completion--done completion 'exact
-                                (unless expect-exact
+                                (unless (or expect-exact
+                                            completion-auto-select)
                                   "Complete, but not unique"))))
 
             (minibuffer--bitset completed t exact))))))))
-- 
2.35.1