aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/icomplete.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/icomplete.el')
-rw-r--r--lisp/icomplete.el34
1 files changed, 21 insertions, 13 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index c1d9556e24d..875c41bd841 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -79,11 +79,12 @@ selection process starts again from the user's $HOME."
79(defcustom icomplete-show-matches-on-no-input nil 79(defcustom icomplete-show-matches-on-no-input nil
80 "When non-nil, show completions when first prompting for input. 80 "When non-nil, show completions when first prompting for input.
81This means to show completions even when the current minibuffer contents 81This means to show completions even when the current minibuffer contents
82is the same as was the initial input after minibuffer activation. 82is the same as the initial input after minibuffer activation.
83This also means that if you traverse the list of completions with 83This also means that if you just hit \\`C-j' without typing any
84commands like \\`C-.' and just hit \\`RET' without typing any 84characters, this chooses the first completion candidate instead of the
85characters, the match under point will be chosen instead of the 85minibuffer's default value.
86default." 86
87See also `icomplete-ret'."
87 :type 'boolean 88 :type 'boolean
88 :version "24.4") 89 :version "24.4")
89 90
@@ -242,16 +243,25 @@ Used to implement the option `icomplete-show-matches-on-no-input'.")
242 :doc "Keymap used by `icomplete-mode' in the minibuffer." 243 :doc "Keymap used by `icomplete-mode' in the minibuffer."
243 "C-M-i" #'icomplete-force-complete 244 "C-M-i" #'icomplete-force-complete
244 "C-j" #'icomplete-force-complete-and-exit 245 "C-j" #'icomplete-force-complete-and-exit
245 "M-j" #'icomplete-exit
246 "C-." #'icomplete-forward-completions 246 "C-." #'icomplete-forward-completions
247 "C-," #'icomplete-backward-completions 247 "C-," #'icomplete-backward-completions)
248 "<remap> <minibuffer-complete-and-exit>" #'icomplete-ret)
249 248
250(defun icomplete-ret () 249(defun icomplete-ret ()
251 "Exit minibuffer for icomplete." 250 "Alternative minibuffer exit for Icomplete.
251If there is a completion candidate and the minibuffer contents is the
252same as it was right after minibuffer activation, exit selecting that
253candidate. Otherwise do as `minibuffer-complete-and-exit'.
254
255You may wish to consider binding this command to \\`RET' (or to
256`<remap> <minibuffer-complete-and-exit>') in `icomplete-minibuffer-map'.
257If you do that, then when Emacs first prompts for input such that the
258current minibuffer contents is equal to the initial input right after
259minibuffer activation, \\`RET' chooses the first completion candidate
260instead of the minibuffer's default value.
261This rebinding is especially useful if you have customized
262`icomplete-show-matches-on-no-input' to a non-nil value."
252 (interactive) 263 (interactive)
253 (if (and icomplete-show-matches-on-no-input 264 (if (and (car completion-all-sorted-completions)
254 (car completion-all-sorted-completions)
255 (equal (icomplete--field-string) icomplete--initial-input)) 265 (equal (icomplete--field-string) icomplete--initial-input))
256 (icomplete-force-complete-and-exit) 266 (icomplete-force-complete-and-exit)
257 (minibuffer-complete-and-exit))) 267 (minibuffer-complete-and-exit)))
@@ -456,8 +466,6 @@ if that doesn't produce a completion match."
456 (minibuffer-complete-and-exit) 466 (minibuffer-complete-and-exit)
457 (exit-minibuffer))) 467 (exit-minibuffer)))
458 468
459(defalias 'icomplete-exit #'icomplete-fido-exit)
460
461(defun icomplete-fido-backward-updir () 469(defun icomplete-fido-backward-updir ()
462 "Delete char before or go up directory, like `ido-mode'." 470 "Delete char before or go up directory, like `ido-mode'."
463 (interactive) 471 (interactive)