protesilaos / mct

Enhancements for the default minibuffer completion UI of Emacs.
https://protesilaos.com/emacs/mct
GNU General Public License v3.0
36 stars 3 forks source link

Use minibuffer-visible-completions in Emacs 30 #9

Open catern opened 1 week ago

catern commented 1 week ago

Emacs 30 has a new customization, minibuffer-visible-completions:

(defcustom minibuffer-visible-completions nil
  "When non-nil, visible completions can be navigated from the minibuffer.
This means that when the *Completions* buffer is visible in a window,
then you can use the arrow keys in the minibuffer to move the cursor
in the *Completions* buffer.  Then you can type `RET',
and the candidate highlighted in the *Completions* buffer
will be accepted.
But when the *Completions* buffer is not displayed on the screen,
then the arrow keys move point in the minibuffer as usual, and
`RET' accepts the input typed in the minibuffer."
  :type 'boolean
  :version "30.1")

mct might find this useful?

catern commented 1 week ago

Also relevant is completion-auto-deselect:

(defcustom completion-auto-deselect t
  "If non-nil, deselect current completion candidate when you type in minibuffer.

A non-nil value means that after typing at the minibuffer prompt,
any completion candidate highlighted in *Completions* window (to
indicate that it is the selected candidate) will be un-highlighted,
and point in the *Completions* window will be moved off such a candidate.
This means that `RET' (`minibuffer-choose-completion-or-exit') will exit
the minibuffer with the minibuffer's current contents, instead of the
selected completion candidate."
  :type '(choice (const :tag "Candidates in *Completions* stay selected as you type" nil)
                 (const :tag "Typing deselects any completion candidate in *Completions*" t))
  :version "30.1")

(I admit this was intended as a first step towards auto-updating functionality in upstream Emacs... or at least to ensure minibuffer-visible-completions was compatible with that)