* lisp/minibuffer.el (minibuffer-completion-auto-choose): New defcustom.
(minibuffer-choose-previous-completion) (minibuffer-choose-next-completion): Remove commands. (minibuffer-local-completion-map): Remove keybindings of minibuffer-choose-next-completion and minibuffer-choose-previous-completion. Use them for minibuffer-next-completion and minibuffer-previous-completion. * lisp/simple.el (minibuffer-local-shell-command-map): Idem.
This commit is contained in:
parent
1c28b9ed1a
commit
67505e0355
3 changed files with 31 additions and 30 deletions
3
etc/NEWS
3
etc/NEWS
|
@ -605,7 +605,8 @@ value.
|
|||
When the minibuffer is the current buffer, typing 'M-<up>' or
|
||||
'M-<down>' selects a previous/next completion candidate from the
|
||||
"*Completions*" buffer and inserts it to the minibuffer.
|
||||
'M-S-<up>' and 'M-S-<down>' do the same, but without inserting
|
||||
When the variable 'minibuffer-completion-auto-choose' is nil,
|
||||
'M-<up>' and 'M-<down>' do the same, but without inserting
|
||||
a completion candidate to the minibuffer, then 'M-RET' can be used
|
||||
to choose the currently active candidate from the "*Completions*"
|
||||
buffer and exit the minibuffer. With a prefix argument, 'C-u M-RET'
|
||||
|
|
|
@ -2749,11 +2749,9 @@ The completion method is determined by `completion-at-point-functions'."
|
|||
"<prior>" #'switch-to-completions
|
||||
"M-v" #'switch-to-completions
|
||||
"M-g M-c" #'switch-to-completions
|
||||
"M-<up>" #'minibuffer-choose-previous-completion
|
||||
"M-<down>" #'minibuffer-choose-next-completion
|
||||
"M-S-<up>" #'minibuffer-previous-completion
|
||||
"M-S-<down>" #'minibuffer-next-completion
|
||||
"M-RET" #'minibuffer-choose-completion)
|
||||
"M-<up>" #'minibuffer-previous-completion
|
||||
"M-<down>" #'minibuffer-next-completion
|
||||
"M-RET" #'minibuffer-choose-completion)
|
||||
|
||||
(defvar-keymap minibuffer-local-must-match-map
|
||||
:doc "Local keymap for minibuffer input with completion, for exact match."
|
||||
|
@ -4356,35 +4354,39 @@ and execute the forms."
|
|||
(with-selected-window window
|
||||
,@body))))
|
||||
|
||||
(defun minibuffer-previous-completion (&optional n)
|
||||
"Run `previous-completion' from the minibuffer in its completions window."
|
||||
(interactive "p")
|
||||
(with-minibuffer-completions-window
|
||||
(when completions-highlight-face
|
||||
(setq-local cursor-face-highlight-nonselected-window t))
|
||||
(previous-completion (or n 1))))
|
||||
(defcustom minibuffer-completion-auto-choose t
|
||||
"Non-nil means to automatically insert completions to the minibuffer.
|
||||
When non-nil, then `minibuffer-next-completion' and
|
||||
`minibuffer-previous-completion' will insert the completion
|
||||
selected by these commands to the minibuffer."
|
||||
:type 'boolean
|
||||
:version "29.1")
|
||||
|
||||
(defun minibuffer-next-completion (&optional n)
|
||||
"Run `next-completion' from the minibuffer in its completions window."
|
||||
"Run `next-completion' from the minibuffer in its completions window.
|
||||
When `minibuffer-completion-auto-choose' is non-nil, then also
|
||||
insert the selected completion to the minibuffer."
|
||||
(interactive "p")
|
||||
(with-minibuffer-completions-window
|
||||
(when completions-highlight-face
|
||||
(setq-local cursor-face-highlight-nonselected-window t))
|
||||
(next-completion (or n 1))))
|
||||
(next-completion (or n 1))
|
||||
(when minibuffer-completion-auto-choose
|
||||
(let ((completion-use-base-affixes t))
|
||||
(choose-completion nil t t)))))
|
||||
|
||||
(defun minibuffer-choose-previous-completion (&optional n)
|
||||
(defun minibuffer-previous-completion (&optional n)
|
||||
"Run `previous-completion' from the minibuffer in its completions window.
|
||||
Also insert the selected completion to the minibuffer."
|
||||
When `minibuffer-completion-auto-choose' is non-nil, then also
|
||||
insert the selected completion to the minibuffer."
|
||||
(interactive "p")
|
||||
(minibuffer-previous-completion n)
|
||||
(minibuffer-choose-completion t t))
|
||||
|
||||
(defun minibuffer-choose-next-completion (&optional n)
|
||||
"Run `next-completion' from the minibuffer in its completions window.
|
||||
Also insert the selected completion to the minibuffer."
|
||||
(interactive "p")
|
||||
(minibuffer-next-completion n)
|
||||
(minibuffer-choose-completion t t))
|
||||
(with-minibuffer-completions-window
|
||||
(when completions-highlight-face
|
||||
(setq-local cursor-face-highlight-nonselected-window t))
|
||||
(previous-completion (or n 1))
|
||||
(when minibuffer-completion-auto-choose
|
||||
(let ((completion-use-base-affixes t))
|
||||
(choose-completion nil t t)))))
|
||||
|
||||
(defun minibuffer-choose-completion (&optional no-exit no-quit)
|
||||
"Run `choose-completion' from the minibuffer in its completions window.
|
||||
|
|
|
@ -3924,10 +3924,8 @@ to the end of the list of defaults just after the default value."
|
|||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map minibuffer-local-map)
|
||||
(define-key map "\t" #'completion-at-point)
|
||||
(define-key map [M-up] #'minibuffer-choose-previous-completion)
|
||||
(define-key map [M-down] #'minibuffer-choose-next-completion)
|
||||
(define-key map [M-S-up] #'minibuffer-previous-completion)
|
||||
(define-key map [M-S-down] #'minibuffer-next-completion)
|
||||
(define-key map [M-up] #'minibuffer-previous-completion)
|
||||
(define-key map [M-down] #'minibuffer-next-completion)
|
||||
(define-key map [?\M-\r] #'minibuffer-choose-completion)
|
||||
map)
|
||||
"Keymap used for completing shell commands in minibuffer.")
|
||||
|
|
Loading…
Add table
Reference in a new issue