mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
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>.
This commit is contained in:
parent
744e97ce6d
commit
1b8d369c38
3 changed files with 23 additions and 4 deletions
6
etc/NEWS
6
etc/NEWS
|
|
@ -785,6 +785,12 @@ digits.
|
||||||
|
|
||||||
** Miscellaneous
|
** Miscellaneous
|
||||||
|
|
||||||
|
---
|
||||||
|
*** 'icomplete-show-matches-on-no-input' behavior change
|
||||||
|
Previously, choosing a different completion with commands like 'C-.'
|
||||||
|
and then hitting enter would choose the default completion. Doung
|
||||||
|
this will now choose the completion under point.
|
||||||
|
|
||||||
---
|
---
|
||||||
*** New user option 'term-scroll-snap-to-bottom'.
|
*** New user option 'term-scroll-snap-to-bottom'.
|
||||||
By default, 'term' and 'ansi-term' will now recenter the buffer so
|
By default, 'term' and 'ansi-term' will now recenter the buffer so
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,11 @@ everything preceding the ~/ is discarded so the interactive
|
||||||
selection process starts again from the user's $HOME.")
|
selection process starts again from the user's $HOME.")
|
||||||
|
|
||||||
(defcustom icomplete-show-matches-on-no-input nil
|
(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
|
:type 'boolean
|
||||||
:version "24.4")
|
:version "24.4")
|
||||||
|
|
||||||
|
|
@ -709,6 +713,9 @@ matches exist."
|
||||||
(push comp prospects)
|
(push comp prospects)
|
||||||
(setq limit t))))
|
(setq limit t))))
|
||||||
(setq prospects (nreverse prospects))
|
(setq prospects (nreverse 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.
|
;; Decorate first of the prospects.
|
||||||
(when prospects
|
(when prospects
|
||||||
(let ((first (copy-sequence (pop prospects))))
|
(let ((first (copy-sequence (pop prospects))))
|
||||||
|
|
|
||||||
|
|
@ -1119,6 +1119,7 @@ completion candidates than this number."
|
||||||
(defvar-local completion-all-sorted-completions nil)
|
(defvar-local completion-all-sorted-completions nil)
|
||||||
(defvar-local completion--all-sorted-completions-location nil)
|
(defvar-local completion--all-sorted-completions-location nil)
|
||||||
(defvar completion-cycling nil) ;Function that takes down the cycling map.
|
(defvar completion-cycling nil) ;Function that takes down the cycling map.
|
||||||
|
(defvar completion-content-when-empty nil)
|
||||||
|
|
||||||
(defvar completion-fail-discreetly nil
|
(defvar completion-fail-discreetly nil
|
||||||
"If non-nil, stay quiet when there is no match.")
|
"If non-nil, stay quiet when there is no match.")
|
||||||
|
|
@ -1503,8 +1504,13 @@ If `minibuffer-completion-confirm' is `confirm-after-completion',
|
||||||
COMPLETION-FUNCTION is called if the current buffer's content does not
|
COMPLETION-FUNCTION is called if the current buffer's content does not
|
||||||
appear to be a match."
|
appear to be a match."
|
||||||
(cond
|
(cond
|
||||||
;; Allow user to specify null string
|
;; Allow user to specify null string. In the case that
|
||||||
((= beg end) (funcall exit-function))
|
;; `completion-content-when-empty' is set, use that instead.
|
||||||
|
((= beg end)
|
||||||
|
(when completion-content-when-empty
|
||||||
|
(completion--replace beg end completion-content-when-empty))
|
||||||
|
(funcall exit-function))
|
||||||
|
|
||||||
((test-completion (buffer-substring beg end)
|
((test-completion (buffer-substring beg end)
|
||||||
minibuffer-completion-table
|
minibuffer-completion-table
|
||||||
minibuffer-completion-predicate)
|
minibuffer-completion-predicate)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue