New key 'M-j' for 'icomplete-mode' (bug#62108)

* lisp/icomplete.el (icomplete-exit): New alias for 'icomplete-fido-exit'.
(icomplete-minibuffer-map): Bind it to "M-j" .

* lisp/replace.el (multi-occur--prompt): Show "M-j" bound to 'icomplete-exit'
in 'icomplete-mode'.
This commit is contained in:
Juri Linkov
2026-01-30 09:27:12 +02:00
parent 31944efb82
commit 3584a762b8
3 changed files with 10 additions and 0 deletions

View File

@@ -3057,6 +3057,10 @@ Meant to be given a global binding convenient to the user. Example:
** Icomplete
*** New key 'M-j' for 'icomplete-mode' and 'icomplete-vertical-mode'.
Like 'M-j' in 'fido-mode', it can exit the minibuffer with a selected
candidate even when 'icomplete-show-matches-on-no-input' is non-nil.
*** New user options for 'icomplete-vertical-mode'.
New user options have been added to enhance 'icomplete-vertical-mode':

View File

@@ -242,6 +242,7 @@ Used to implement the option `icomplete-show-matches-on-no-input'.")
:doc "Keymap used by `icomplete-mode' in the minibuffer."
"C-M-i" #'icomplete-force-complete
"C-j" #'icomplete-force-complete-and-exit
"M-j" #'icomplete-exit
"C-." #'icomplete-forward-completions
"C-," #'icomplete-backward-completions
"<remap> <minibuffer-complete-and-exit>" #'icomplete-ret)
@@ -455,6 +456,8 @@ if that doesn't produce a completion match."
(minibuffer-complete-and-exit)
(exit-minibuffer)))
(defalias 'icomplete-exit #'icomplete-fido-exit)
(defun icomplete-fido-backward-updir ()
"Delete char before or go up directory, like `ido-mode'."
(interactive)

View File

@@ -1878,6 +1878,9 @@ is not modified."
(bound-and-true-p ido-everywhere))
(substitute-command-keys
"(\\<ido-completion-map>\\[ido-select-text] to end): "))
((bound-and-true-p icomplete-mode)
(substitute-command-keys
"(\\<icomplete-minibuffer-map>\\[icomplete-exit] to end): "))
((bound-and-true-p fido-mode)
(substitute-command-keys
"(\\<icomplete-fido-mode-map>\\[icomplete-fido-exit] to end): "))