From 3584a762b8cbfb6e13011827ec5934f039344d0f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 30 Jan 2026 09:27:12 +0200 Subject: [PATCH] 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'. --- etc/NEWS | 4 ++++ lisp/icomplete.el | 3 +++ lisp/replace.el | 3 +++ 3 files changed, 10 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 1ed41795fe3..1838a1ec3e5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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': diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 6de3dd0b50a..c1d9556e24d 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -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 " " #'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) diff --git a/lisp/replace.el b/lisp/replace.el index 933249d824c..d8b27544128 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1878,6 +1878,9 @@ is not modified." (bound-and-true-p ido-everywhere)) (substitute-command-keys "(\\\\[ido-select-text] to end): ")) + ((bound-and-true-p icomplete-mode) + (substitute-command-keys + "(\\\\[icomplete-exit] to end): ")) ((bound-and-true-p fido-mode) (substitute-command-keys "(\\\\[icomplete-fido-exit] to end): "))