From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Leach Newsgroups: gmane.emacs.bugs Subject: bug#19032: 24.4; icomplete cannot select matches with C-x b with no input Date: Sat, 15 Nov 2014 23:08:12 +0000 Message-ID: <8761egqcyr.fsf@matt-desktop.home> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1416092965 26092 80.91.229.3 (15 Nov 2014 23:09:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 23:09:25 +0000 (UTC) Cc: 19032@debbugs.gnu.org To: Ole Laursen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 16 00:09:17 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XpmSy-00075i-Hi for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Nov 2014 00:09:16 +0100 Original-Received: from localhost ([::1]:42281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpmSy-00061Z-3S for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 18:09:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpmSq-00061R-2M for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 18:09:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpmSk-0004yM-PE for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 18:09:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpmSk-0004yI-MC for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 18:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XpmSk-0000ON-3Q for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 18:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matthew Leach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Nov 2014 23:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19032 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19032-submit@debbugs.gnu.org id=B19032.14160928981407 (code B ref 19032); Sat, 15 Nov 2014 23:09:02 +0000 Original-Received: (at 19032) by debbugs.gnu.org; 15 Nov 2014 23:08:18 +0000 Original-Received: from localhost ([127.0.0.1]:34193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpmS1-0000Md-Do for submit@debbugs.gnu.org; Sat, 15 Nov 2014 18:08:17 -0500 Original-Received: from mx0.mattleach.net ([176.58.118.143]:57918) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpmRz-0000MR-5J for 19032@debbugs.gnu.org; Sat, 15 Nov 2014 18:08:16 -0500 Original-Received: by mx0.mattleach.net (Postfix, from userid 99) id 557D461AC6; Sat, 15 Nov 2014 23:08:14 +0000 (GMT) Original-Received: from matt-desktop.home.mattleach.net (host86-180-142-129.range86-180.btcentralplus.com [86.180.142.129]) by mx0.mattleach.net (Postfix) with ESMTPSA id 7178461AB6; Sat, 15 Nov 2014 23:08:13 +0000 (GMT) In-Reply-To: (Ole Laursen's message of "Wed, 12 Nov 2014 13:31:33 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96091 --=-=-= Content-Type: text/plain Hello, Ole Laursen 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 * 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=icomplete-cycle-fix.patch 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) --=-=-=--