1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-06 14:02:07 -08:00

* lisp/minibuffer.el (minibuffer-choose-completion-or-exit): New command.

(minibuffer-visible-completions-map): Bind it to "RET".
https://lists.gnu.org/archive/html/emacs-devel/2023-11/msg00246.html
This commit is contained in:
Juri Linkov 2023-11-08 09:38:35 +02:00
parent 089b7d4e62
commit 01912a0679

View file

@ -3000,7 +3000,7 @@ displaying the *Completions* buffer exists."
"<right>" (minibuffer-visible-completions-bind #'minibuffer-next-completion)
"<up>" (minibuffer-visible-completions-bind #'minibuffer-previous-line-completion)
"<down>" (minibuffer-visible-completions-bind #'minibuffer-next-line-completion)
"RET" (minibuffer-visible-completions-bind #'minibuffer-choose-completion)
"RET" (minibuffer-visible-completions-bind #'minibuffer-choose-completion-or-exit)
"C-g" (minibuffer-visible-completions-bind #'minibuffer-hide-completions))
@ -4682,10 +4682,20 @@ of `completion-no-auto-exit'.
If NO-QUIT is non-nil, insert the completion candidate at point to the
minibuffer, but don't quit the completions window."
(interactive "P")
(with-minibuffer-completions-window
(with-minibuffer-completions-window
(let ((completion-use-base-affixes t))
(choose-completion nil no-exit no-quit))))
(defun minibuffer-choose-completion-or-exit (&optional no-exit no-quit)
"Choose the completion from the minibuffer or exit the minibuffer.
When `minibuffer-choose-completion' can't find a completion candidate
in the completions window, then exit the minibuffer using its present
contents."
(interactive "P")
(condition-case nil
(minibuffer-choose-completion no-exit no-quit)
(error (exit-minibuffer))))
(defun minibuffer-complete-history ()
"Complete the minibuffer history as far as possible.
Like `minibuffer-complete' but completes on the history items