GNU bug report logs -
#19032
24.4; icomplete cannot select matches with C-x b with no input
Previous Next
Reported by: Ole Laursen <olau <at> iola.dk>
Date: Wed, 12 Nov 2014 16:42:03 UTC
Severity: normal
Tags: fixed, patch
Found in version 24.4
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello,
Ole Laursen <olau <at> iola.dk> writes:
> Run emacs -Q, evaluate
>
> (icomplete-mode 1)
> (setq icomplete-show-matches-on-no-input t)
>
> Make sure you have three buffers, e.g. by finding three files. Then
> hit C-x b which should immediately show all buffers and use C-. or C-,
> to select any other buffer than what the modeline declares to be the
> default, and hit C-j or RET.
>
> Emacs then switches to the default buffer instead of the selected buffer.
I'm not sure if this is expected behaviour, since the "default" prompt
in the minibuffer doesn't disappear when cycling through results.
Nevertheless attached is a patch that fixes this.
--
Matt
lisp/ChangeLog:
2014-11-15 Matthew Leach <matthew <at> mattleach.net>
* minibuffer.el
(completion-use-stored-completions-when-no-input): New.
(completion--complete-and-exit): Use the above to decide whether
to use the car of `completion-all-sorted-completions' as the
candidate.
* icomplete.el (icomplete-minibuffer-setup): set
`completion-use-stored-completions-when-no-input' when
`icomplete-show-matches-on-no-input' is t.
[icomplete-cycle-fix.patch (text/x-diff, inline)]
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)
This bug report was last modified 4 years and 313 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.