From f13ab20f0456f311bc5e1374db2e638bed17f8e9 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 11 Feb 2026 09:50:34 +0200 Subject: [PATCH] Don't remap RET to 'icomplete-ret' in 'icomplete-mode' (bug#62108) * lisp/icomplete.el (icomplete-show-matches-on-no-input): Fix docstring. (icomplete-minibuffer-map): Don't remap 'minibuffer-complete-and-exit' (RET) to 'icomplete-ret'. (icomplete-ret): Improve docstring. --- etc/NEWS | 12 ++++++++++++ lisp/icomplete.el | 15 +++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 0388d47b87e..757a84070ac 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3092,6 +3092,18 @@ Meant to be given a global binding convenient to the user. Example: ** Icomplete +*** Change in meaning of 'icomplete-show-matches-on-no-input' (again). +Previously, choosing a different completion with commands like 'C-.' +and then hitting 'RET' would choose the completion under point +when 'icomplete-show-matches-on-no-input' is customized to non-nil. +Doing this will now choose the default value instead. There is +still 'C-j' to choose the completion under point in 'icomplete-mode'. +You can get back the old behavior of the 'RET' key with + + (keymap-set + icomplete-minibuffer-map " " + #'icomplete-ret) + *** 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..b7002fa545b 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -80,10 +80,10 @@ selection process starts again from the user's $HOME." "When non-nil, show completions when first prompting for input. This means to show completions even when the current minibuffer contents is the same as was the initial input after minibuffer activation. -This also means that if you traverse the list of completions with -commands like \\`C-.' and just hit \\`RET' without typing any +This also means that if you just hit \\`C-j' without typing any characters, the match under point will be chosen instead of the -default." +default. But \\`RET' will still choose the default value exactly +as when this option is nil." :type 'boolean :version "24.4") @@ -243,11 +243,14 @@ Used to implement the option `icomplete-show-matches-on-no-input'.") "C-M-i" #'icomplete-force-complete "C-j" #'icomplete-force-complete-and-exit "C-." #'icomplete-forward-completions - "C-," #'icomplete-backward-completions - " " #'icomplete-ret) + "C-," #'icomplete-backward-completions) (defun icomplete-ret () - "Exit minibuffer for icomplete." + "Exit minibuffer for icomplete. +You can bind this command to \\`RET' in `icomplete-minibuffer-map', +or remap from `minibuffer-complete-and-exit', to be able to choose +the completion under point with \\`RET' instead of choosing the +default value." (interactive) (if (and icomplete-show-matches-on-no-input (car completion-all-sorted-completions)