emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating *Completions* as you type


From: Juri Linkov
Subject: Re: Updating *Completions* as you type
Date: Wed, 18 Oct 2023 09:51:17 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> I think preselecting the default value in the middle of completions
>> would make sense only when completions were sorted by the order of the
>> list of default values (from M-n M-n ...).  Then the first default value
>> would be at the top of completions, and it would easier for users
>> to navigate completions top-down.
>
> Yes, that was the case that inspired this specific idea: the case where
> completions are sorted by the list of defaults, and so the default value
> is the first completion.
>
> But it occured to me that there's no reason to limit to just the case
> where the default value is the first completion.  We can just always
> move point to the default wherever it occurs in the completions, as long
> as it occurs somewhere.  Seems like a nice improvement.
>
> Although I guess it does cause M-<down> to no longer go to the first
> completion, and M-<up> to no longer go to the last one.  Which is a bit
> annoying.

Indeed.

> Maybe we should have bindings to move to the first and last completions.
> Whatever they are, they should also work in completion-in-region-mode,
> though, so M-< and M-> definitely won't work... Maybe M-0 M-<down> to go
> to the first, and M-0 M-<up> to go to the last?  (Or vice versa?)

M-< and M-> work in the minibuffer as well as in the normal buffer.
But they don't work with your first patch ;-)

>> BTW, while looking at this case I found a problem with your first patch:
>> after navigating in *Completions* and switching back to the minibuffer
>> point is reset to the beginning of the *Completions* buffer.
>
> Good catch!  If you see my other patch which I posted in this thread,
> "Keep point on the same completion in the completions buffer", that is a
> nice orthogonal improvement which incidentally also fixes that bug in
> completions-auto-update.

Your third patch adds a new feature that just hides the bug by forcing
the previous position over the wrong new one.  I think the proper fix
would be to add more commands to completions-no-auto-update-commands
in your first patch.  Or to change it from opt-out to opt-in by renaming
to completions-auto-update-commands.

> OK, so maybe the thing I want to propose is not "we'll change the
> default to whatever the current selected completion is" but instead "RET
> with an empty minibuffer will submit the current selected completion".
> That's equivalent, if I drop the ideas of changing the prompt and
> changing M-RET.

Agreed, I think the idea of changing the prompt on the fly won't fly.

>>> I think this has some nice benefits in reducing the number of concepts
>>> people need to track.  If the minibuffer is empty, they can just use
>>> minibuffer-next-completion a few times followed by RET to select a
>>> completion, no need to use M-RET.  Plus, the new M-RET and C-u M-RET
>>> would be useful even to users who don't use minibuffer-next-completion.
>>> True, good analysis.
>>
>> Specifically though it's about the case when the minibuffer is empty.  I
>> think it would be nice for RET to submit the highlighted candidate in
>> that case, if there is one.
>>
>> That matches icomplete-mode's behavior, actually, which is nice.
>
> Oh, actually it doesn't.  It matches ido-mode and fido-mode and a host
> of completion mechanisms outside core, though.  I still think it's
> desirable, at least as a user option.

But then such idiosyncrasy of fido-mode causes a lot of bug reports
like bug#55800.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]