Subject: Re: bug#60411: 29.0.60; minibuffer-next-completion skips first candidate when completions-header-format and completion-show-help are nil

From: Gregory Heytings <[email-masked]>
Date: Fri, 06 Jan 2023 09:01:08 +0000

>>>> Stefan and Eli, do you agree with that conclusion?
>>>
>>> I admit that I've lost the line of reasoning here (too much of the 
>>> previous context is being elided, forcing me to re-read the entire 
>>> discussion).  Which code is proposed for the release branch, and how 
>>> will Emacs behave with that code in this particular use case?
>>
>> It's this patch.  It adds an invisible empty line at the beginning of 
>> *Completions* when completions-header-format is not a string (in 
>> particular, nil) or an empty string.
>
> What is the significance of these two special values of 
> completions-header-format?  Is it that you want to test whether the 
> first candidates starts at buffer position 1 in the *Completions* 
> buffer?  Then why not test for that explicitly?
>

When completions-header-format is nil or an empty string, no completion 
header "NNN possible completions:\n" is inserted in *Completions*. 
Because of this, minibuffer-next-completion (bound to M-<down> by 
default), which is supposed to select the first completion when it is 
called for the first time, erroneously selects the second completion. 
The fact that "something" (the completion header and/or the help text 
"Click on a completion to select it...") must exist in *Completions* 
before the first completion candidate is more or less hardcoded in the 
logic of minibuffer-next-completion.