Function: icomplete-ret
icomplete-ret is an interactive and byte-compiled function defined in
icomplete.el.gz.
Signature
(icomplete-ret)
Documentation
Alternative minibuffer exit for Icomplete.
If there is a completion candidate and the minibuffer contents is the
same as it was right after minibuffer activation, exit selecting that
candidate. Otherwise do as minibuffer-complete-and-exit.
You may wish to consider binding this command to \RET (or to
<remap> <minibuffer-complete-and-exit>) in icomplete-minibuffer-map.
If you do that, then when Emacs first prompts for input such that the
current minibuffer contents is equal to the initial input right after
minibuffer activation, \RET chooses the first completion candidate
instead of the minibuffer's default value.
This rebinding is especially useful if you have customized
icomplete-show-matches-on-no-input to a non-nil value.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/icomplete.el.gz
(defun icomplete-ret ()
"Alternative minibuffer exit for Icomplete.
If there is a completion candidate and the minibuffer contents is the
same as it was right after minibuffer activation, exit selecting that
candidate. Otherwise do as `minibuffer-complete-and-exit'.
You may wish to consider binding this command to \\`RET' (or to
`<remap> <minibuffer-complete-and-exit>') in `icomplete-minibuffer-map'.
If you do that, then when Emacs first prompts for input such that the
current minibuffer contents is equal to the initial input right after
minibuffer activation, \\`RET' chooses the first completion candidate
instead of the minibuffer's default value.
This rebinding is especially useful if you have customized
`icomplete-show-matches-on-no-input' to a non-nil value."
(interactive)
(if (and (car completion-all-sorted-completions)
(equal (icomplete--field-string) icomplete--initial-input))
(icomplete-force-complete-and-exit)
(minibuffer-complete-and-exit)))