emacs-devel
[Top][All Lists]
Advanced

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

Re: Suggestions for improvements to the *Completions* buffer


From: Juri Linkov
Subject: Re: Suggestions for improvements to the *Completions* buffer
Date: Tue, 14 Dec 2021 23:13:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> -    (define-key map "z" 'kill-current-buffer)
>>      (define-key map "\M-g\M-c" 'switch-to-minibuffer)
>> +    (define-key map "z" #'completion-kill-buffer)
>> +    (define-key map [remap keyboard-quit] #'completion-quit)
>> +    (define-key map [remap quit-window] #'switch-to-minibuffer)
>
> It seems that remapping quit-window to switch-to-minibuffer creates
> issues when the completion buffer is not invoked by the minibuffer, but
> e.g. by complete-symbol.  Binding it to completion-quit (defined above)
> instead, might actually be more natural, as "q"/quit-window is expected
> to close a window.

Good point, so `q' should not be rebound from its standard command
`quit-window'.  Like you noticed, currently `quit-window' fails
to select the minibuffer window, but this is a bug, so this regression
was reported in bug#52491.

Then "z" could be bound to a variant of `quit-window'
that calls it with the argument KILL non-nil.

Like currently `ESC ESC ESC' can close the completion window
by the special command `delete-completion-window', then the same
command could be bound to `[remap keyboard-quit]' as well.

> The question is whether or not there is a need for a separate
> switch-to-minibuffer binding (besides M-g M-c)?  Is keeping the
> completions buffer active while returning to the minibuffer a real need?

Good question.  If four key bindings (q, z, C-g, ESC ESC ESC)
all will close the completions (first two using quit-window,
and last two using delete-completion-window), then maybe we should have
an easy-to-type keybinding that will switch to the minibuffer without
closing the completions window?

There is an easy-to-type keys <PgUp> and M-v to switch to the
completions window, but no an easy-to-type key to switch back.

It seems wrong for `q' to switch to the minibuffer without closing
the window because `quit-window' implies that window should quit.
But what key to use instead, I have no idea.



reply via email to

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