GNU bug report logs - #19032
24.4; icomplete cannot select matches with C-x b with no input

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Ole Laursen <olau@HIDDEN>; Keywords: patch; dated Wed, 12 Nov 2014 16:42:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) patch. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 19032 <at> debbugs.gnu.org:


Received: (at 19032) by debbugs.gnu.org; 15 Nov 2014 23:08:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 15 18:08:18 2014
Received: from localhost ([127.0.0.1]:34193 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpmS1-0000Md-Do
	for submit <at> debbugs.gnu.org; Sat, 15 Nov 2014 18:08:17 -0500
Received: from mx0.mattleach.net ([176.58.118.143]:57918)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <matthew@HIDDEN>) id 1XpmRz-0000MR-5J
 for 19032 <at> debbugs.gnu.org; Sat, 15 Nov 2014 18:08:16 -0500
Received: by mx0.mattleach.net (Postfix, from userid 99)
 id 557D461AC6; Sat, 15 Nov 2014 23:08:14 +0000 (GMT)
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mx0.mattleach.net
X-Spam-Level: 
X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED
 autolearn=disabled version=3.4.0
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)
From: Matthew Leach <matthew@HIDDEN>
To: Ole Laursen <olau@HIDDEN>
Subject: Re: bug#19032: 24.4;
 icomplete cannot select matches with C-x b with no input
In-Reply-To: <CANb2Ov+GMZ6qjaE7Of49n2dckT-1D9hAXPG7aQzarOLxphTUcA@HIDDEN>
 (Ole Laursen's message of "Wed, 12 Nov 2014 13:31:33 +0100")
References: <CANb2Ov+GMZ6qjaE7Of49n2dckT-1D9hAXPG7aQzarOLxphTUcA@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
Date: Sat, 15 Nov 2014 23:08:12 +0000
Message-ID: <8761egqcyr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 19032
Cc: 19032 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

Hello,

Ole Laursen <olau@HIDDEN> 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@HIDDEN>

	* 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)

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#19032; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Nov 2014 16:41:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 12 11:41:49 2014
Received: from localhost ([127.0.0.1]:58864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XoazM-0001f9-MB
	for submit <at> debbugs.gnu.org; Wed, 12 Nov 2014 11:41:48 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37729)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <olau@HIDDEN>) id 1XoX5s-0003s5-4B
 for submit <at> debbugs.gnu.org; Wed, 12 Nov 2014 07:32:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <olau@HIDDEN>) id 1XoX5i-0002RY-Ta
 for submit <at> debbugs.gnu.org; Wed, 12 Nov 2014 07:32:15 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:46433)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <olau@HIDDEN>)
 id 1XoX5i-0002RU-RE
 for submit <at> debbugs.gnu.org; Wed, 12 Nov 2014 07:32:06 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39436)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <olau@HIDDEN>) id 1XoX5c-00021v-Gj
 for bug-gnu-emacs@HIDDEN; Wed, 12 Nov 2014 07:32:06 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <olau@HIDDEN>) id 1XoX5W-0002Pw-9M
 for bug-gnu-emacs@HIDDEN; Wed, 12 Nov 2014 07:32:00 -0500
Received: from mail-vc0-f171.google.com ([209.85.220.171]:54676)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <olau@HIDDEN>)
 id 1XoX5W-0002Ps-6F
 for bug-gnu-emacs@HIDDEN; Wed, 12 Nov 2014 07:31:54 -0500
Received: by mail-vc0-f171.google.com with SMTP id id10so2055215vcb.16
 for <bug-gnu-emacs@HIDDEN>; Wed, 12 Nov 2014 04:31:53 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to
 :content-type;
 bh=j7gXBj6Ta4RqelWeIFGgQR0ymQRlfNVkpGEhdpSogI4=;
 b=P09g3ut3nTG9COJq9+F6UoFFjydC5/AxAZDaAHFRzjr2kQfCq5Nw23ZF2L8JyP9yc1
 i8rb3uipcrDLnIP3qAPmgLXpIPBx4q/yqh4rcK75y8ARXtx8C/p8XhQM+0Ol0tqHWIMX
 G4TcKKTtWYUskdggkQboyHy+0FMQTlNA4cho3Sv/+gp/UmRW6KwZohpPGVj+8XXOWWVn
 zoBNeQfZDVl8blQ8/XCqhRGL9WKVnoLp2pehJlF3x7kQii4rvUgk3GHlMFZfaAliBlkM
 0+mMQMQmqUUKTQNu3WOuedCaZfg8O+b862zCN3KwhuLQHsN8PibLyEP5KXSgUvHK30Ep
 g1pA==
X-Gm-Message-State: ALoCoQmwSmpbIo9g0br7K3obRTTxGbvfT++sZGYoQHSlqkeWJBNBQQV1UGQYS15C/TxcwzSnYgkW
X-Received: by 10.220.127.5 with SMTP id e5mr13496707vcs.40.1415795513596;
 Wed, 12 Nov 2014 04:31:53 -0800 (PST)
MIME-Version: 1.0
Received: by 10.220.99.133 with HTTP; Wed, 12 Nov 2014 04:31:33 -0800 (PST)
From: Ole Laursen <olau@HIDDEN>
Date: Wed, 12 Nov 2014 13:31:33 +0100
Message-ID: <CANb2Ov+GMZ6qjaE7Of49n2dckT-1D9hAXPG7aQzarOLxphTUcA@HIDDEN>
Subject: 24.4; icomplete cannot select matches with C-x b with no input
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 12 Nov 2014 11:41:44 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

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.


Ole




Acknowledgement sent to Ole Laursen <olau@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#19032; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.