diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 95a6e1b..dc90f0e 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -262,6 +262,7 @@ Usually run by inclusion in `minibuffer-setup-hook'." (add-hook 'post-command-hook #'icomplete-post-command-hook nil t) (run-hooks 'icomplete-minibuffer-setup-hook) (when icomplete-show-matches-on-no-input + (setq completion-use-stored-completions-when-no-input t) (icomplete-exhibit)))) (defvar icomplete--in-region-buffer nil) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c9ce381..4ea0530 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -969,6 +969,7 @@ completion candidates than this number." (defvar-local completion-all-sorted-completions nil) (defvar-local completion--all-sorted-completions-location nil) (defvar completion-cycling nil) +(defvar completion-use-stored-completions-when-no-input nil) (defvar completion-fail-discreetly nil "If non-nil, stay quiet when there is no match.") @@ -1332,8 +1333,15 @@ If `minibuffer-completion-confirm' is `confirm-after-completion', COMPLETION-FUNCTION is called if the current buffer's content does not appear to be a match." (cond - ;; Allow user to specify null string - ((= beg end) (funcall exit-function)) + ;; Allow user to specify null string. In the case that + ;; `completion-use-stored-completions-when-no-input' is t, use + ;; the car of `completion-all-sorted-completions' as the + ;; candidate. + ((= beg end) + (when completion-use-stored-completions-when-no-input + (completion--replace beg end (car completion-all-sorted-completions))) + (funcall exit-function)) + ((test-completion (buffer-substring beg end) minibuffer-completion-table minibuffer-completion-predicate)