diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2020-08-14 13:29:52 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-08-14 13:29:59 +0200 |
commit | 1b8d369c381b5a63e40529d0d95dfa75d94b8e09 (patch) | |
tree | 7726c2a30459e5db8ac31f76b2878a4f3f11dad6 /lisp/icomplete.el | |
parent | 744e97ce6d9fc5c3f8653e4840b00ef0cd14278f (diff) | |
download | emacs-1b8d369c381b5a63e40529d0d95dfa75d94b8e09.tar.gz emacs-1b8d369c381b5a63e40529d0d95dfa75d94b8e09.tar.bz2 emacs-1b8d369c381b5a63e40529d0d95dfa75d94b8e09.zip |
Change icomplete-show-matches-on-no-input behavior
* lisp/icomplete.el (icomplete-show-matches-on-no-input): Doc fix.
(icomplete-completions): Set completion-content-when-empty.
* lisp/minibuffer.el (completion-content-when-empty): New variable.
(completion--complete-and-exit): Use it (bug#19032).
Based on a patch by Matthew Leach <matthew@mattleach.net>.
Diffstat (limited to 'lisp/icomplete.el')
-rw-r--r-- | lisp/icomplete.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 3747ae3d281..8a68df876c1 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -75,7 +75,11 @@ everything preceding the ~/ is discarded so the interactive selection process starts again from the user's $HOME.") (defcustom icomplete-show-matches-on-no-input nil - "When non-nil, show completions when first prompting for input." + "When non-nil, show completions when first prompting for input. +This also means that if you traverse the list of completions with +commands like `C-.' and just hit `C-j' (enter) without typing any +characters, the match under point will be chosen instead of the +default." :type 'boolean :version "24.4") @@ -709,7 +713,10 @@ matches exist." (push comp prospects) (setq limit t)))) (setq prospects (nreverse prospects)) - ;; Decorate first of the prospects. + ;; Return the first match if the user hits enter. + (when icomplete-show-matches-on-no-input + (setq completion-content-when-empty (car prospects))) + ;; Decorate first of the prospects. (when prospects (let ((first (copy-sequence (pop prospects)))) (put-text-property 0 (length first) |