From unknown Sat Aug 16 10:45:18 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#7266 <7266@debbugs.gnu.org> To: bug#7266 <7266@debbugs.gnu.org> Subject: Status: Patch to fix minibuffer-complete when icomplete-mode is on and completion-cycle-threshold is nil Reply-To: bug#7266 <7266@debbugs.gnu.org> Date: Sat, 16 Aug 2025 17:45:18 +0000 retitle 7266 Patch to fix minibuffer-complete when icomplete-mode is on and= completion-cycle-threshold is nil reassign 7266 emacs submitter 7266 Fran Litterio severity 7266 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 22 12:00:53 2010 Received: (at submit) by debbugs.gnu.org; 22 Oct 2010 16:00:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P9K31-0004d3-Vw for submit@debbugs.gnu.org; Fri, 22 Oct 2010 12:00:52 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P9JHc-0003a7-Lj for submit@debbugs.gnu.org; Fri, 22 Oct 2010 11:11:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9JLN-0004Hn-JR for submit@debbugs.gnu.org; Fri, 22 Oct 2010 11:15:46 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:38608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P9JLM-0004HB-Hs for submit@debbugs.gnu.org; Fri, 22 Oct 2010 11:15:45 -0400 Received: from [140.186.70.92] (port=38026 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9JLH-0003dd-Jy for bug-gnu-emacs@gnu.org; Fri, 22 Oct 2010 11:15:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9JA7-0001yp-2T for bug-gnu-emacs@gnu.org; Fri, 22 Oct 2010 11:04:08 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:48533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P9JA6-0001yc-Uj for bug-gnu-emacs@gnu.org; Fri, 22 Oct 2010 11:04:07 -0400 Received: by wwb34 with SMTP id 34so1064366wwb.30 for ; Fri, 22 Oct 2010 08:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=YtFbkUU58+AKkyUmDMJpenV7Co2yHYwYbOZKgSuL0ww=; b=lWPckWE9+0dLYtdbd7IbnhmXD41y0Cf9dWKZEbRW8nt2cNF7anbcupxoMxMvaYPylO kM2kAKrHGgTUK8JsxNctXXdG/FF6tFYTRWEss1UyiuOXKhJSgEibhqu6MtpmVEBl6luL +waip27nBEmeMZrozU7IXU6o6gHqD1ksVfdb4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=sBAbLjO5p3wD/lQV1HNIa1US3Aex2WncNWOaR6JlgIpi495TVn5GlLg60mafJIxteY V4P646IsCKax9Ju//KreamfM9MbfK3MEWr9r6R4ryLvRg2ureoHm/jdzzD1xliBi9ZC2 o5+nYt3kdI2/dAn6ubF0ceiHtPOoDfcIFaVtU= Received: by 10.227.134.206 with SMTP id k14mr2958230wbt.121.1287759845502; Fri, 22 Oct 2010 08:04:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.133.99 with HTTP; Fri, 22 Oct 2010 08:03:44 -0700 (PDT) From: Fran Litterio Date: Fri, 22 Oct 2010 11:03:44 -0400 Message-ID: Subject: Patch to fix minibuffer-complete when icomplete-mode is on and completion-cycle-threshold is nil To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 22 Oct 2010 12:00:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) To reproduce the bug do this: 1. Launch "emacs -q". 2. Type: ESC ESC : (icomplete-mode 1) RET C-h v mini TAB TAB Notice that minibuffer-complete (which is bound to TAB at this point) is cycling through the completion choices instead of popping up a window to display the completion choices. This bug is caused code in lisp/minibuffer.el that does not check that the value of completion-cycle-threshold is not nil before deciding to cycle completions. This patch (to the Bazaar sources) fixes the bug: --- lisp/minibuffer.el.orig 2010-10-21 17:55:46.380857900 -0400 +++ lisp/minibuffer.el 2010-10-22 10:29:29.188417500 -0400 @@ -607,7 +607,8 @@ (completion-all-sorted-completions)))) (setq completion-all-sorted-completions nil) (cond - ((and (not (ignore-errors + ((and completion-cycle-threshold ;; Never cycle if completion-cycle-threshold is nil. + (not (ignore-errors ;; This signal an (intended) error if comps is too ;; short or if completion-cycle-threshold is t. (consp (nthcdr completion-cycle-threshold comps)))) @@ -664,7 +665,8 @@ (scroll-other-window)) nil))) ;; If we're cycling, keep on cycling. - (completion-all-sorted-completions + ((and completion-cycle-threshold ;; Never cycle if completion-cycle-threshold is nil. + completion-all-sorted-completions) (minibuffer-force-complete) t) (t (case (completion--do-completion) From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 27 22:19:11 2010 Received: (at 7266) by debbugs.gnu.org; 28 Oct 2010 02:19:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBI58-0002E6-7R for submit@debbugs.gnu.org; Wed, 27 Oct 2010 22:19:10 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBI56-0002E1-Rc for 7266@debbugs.gnu.org; Wed, 27 Oct 2010 22:19:09 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgQJAGR7yExFxL/T/2dsb2JhbACgSHxywD6FSASSKg X-IronPort-AV: E=Sophos;i="4.58,248,1286164800"; d="scan'208";a="80872790" Received: from 69-196-191-211.dsl.teksavvy.com (HELO pastel.home) ([69.196.191.211]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 27 Oct 2010 22:23:15 -0400 Received: by pastel.home (Postfix, from userid 20848) id 59C49A8558; Wed, 27 Oct 2010 22:23:15 -0400 (EDT) From: Stefan Monnier To: Fran Litterio Subject: Re: Patch to fix minibuffer-complete when icomplete-mode is on and completion-cycle-threshold is nil Message-ID: References: Date: Wed, 27 Oct 2010 22:23:15 -0400 In-Reply-To: (Fran Litterio's message of "Fri, 22 Oct 2010 11:03:44 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 7266 Cc: 7266@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > 2. Type: ESC ESC : (icomplete-mode 1) RET C-h v mini TAB TAB > Notice that minibuffer-complete (which is bound to TAB at this point) > is cycling through the completion choices instead of popping up a > window to display the completion choices. This bug is caused code in > lisp/minibuffer.el that does not check that the value of > completion-cycle-threshold is not nil before deciding to cycle > completions. This patch (to the Bazaar sources) fixes the bug: Thanks very much. Indeed, there's a problem here, but... > @@ -607,7 +607,8 @@ > (completion-all-sorted-completions)))) > (setq completion-all-sorted-completions nil) > (cond > - ((and (not (ignore-errors > + ((and completion-cycle-threshold ;; Never cycle if > completion-cycle-threshold is nil. > + (not (ignore-errors > ;; This signal an (intended) error if comps is too > ;; short or if completion-cycle-threshold is t. > (consp (nthcdr completion-cycle-threshold comps)))) Hmm... AFAICT if completion-cycle-threshold is nil, then comps will also be nil, so this change should not make any difference. > @@ -664,7 +665,8 @@ > (scroll-other-window)) > nil))) > ;; If we're cycling, keep on cycling. > - (completion-all-sorted-completions > + ((and completion-cycle-threshold ;; Never cycle if > completion-cycle-threshold is nil. > + completion-all-sorted-completions) > (minibuffer-force-complete) > t) > (t (case (completion--do-completion) It goes a bit further than that: even if completion-cycle-threshold is non-nil and completion-all-sorted-completions is set, it may still be wrong to call minibuffer-force-complete since completion-all-sorted-completions may only be set because of icomplete rather than because we're cycling (e.g. the completion list may be larger than the threshold). So I've installed the patch below instead. Please confirm that it fixes the problem. Stefan === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2010-10-19 11:44:07 +0000 +++ lisp/minibuffer.el 2010-10-28 02:16:06 +0000 @@ -526,6 +526,10 @@ (const :tag "Always cycle" t) (integer :tag "Threshold"))) +(defvar completion-all-sorted-completions nil) +(make-variable-buffer-local 'completion-all-sorted-completions) +(defvar completion-cycling nil) + (defun completion--do-completion (&optional try-completion-function) "Do the completion and return a summary of what happened. M = completion was performed, the text was Modified. @@ -605,14 +609,13 @@ "")) comp-pos))) (completion-all-sorted-completions)))) - (setq completion-all-sorted-completions nil) + (completion--flush-all-sorted-completions) (cond - ((and (not (ignore-errors + ((and (consp (cdr comps)) ;; There's something to cycle. + (not (ignore-errors ;; This signal an (intended) error if comps is too ;; short or if completion-cycle-threshold is t. - (consp (nthcdr completion-cycle-threshold comps)))) - ;; More than 1, so there's something to cycle. - (consp (cdr comps))) + (consp (nthcdr completion-cycle-threshold comps))))) ;; Fewer than completion-cycle-threshold remaining ;; completions: let's cycle. (setq completed t exact t) @@ -648,7 +651,7 @@ ;; If the previous command was not this, ;; mark the completion buffer obsolete. (unless (eq this-command last-command) - (setq completion-all-sorted-completions nil) + (completion--flush-all-sorted-completions) (setq minibuffer-scroll-window nil)) (cond @@ -664,7 +667,7 @@ (scroll-other-window)) nil))) ;; If we're cycling, keep on cycling. - (completion-all-sorted-completions + ((and completion-cycling completion-all-sorted-completions) (minibuffer-force-complete) t) (t (case (completion--do-completion) @@ -675,10 +678,8 @@ t) (t t))))) -(defvar completion-all-sorted-completions nil) -(make-variable-buffer-local 'completion-all-sorted-completions) - (defun completion--flush-all-sorted-completions (&rest ignore) + (setq completion-cycling nil) (setq completion-all-sorted-completions nil)) (defun completion-all-sorted-completions () @@ -720,6 +721,7 @@ (all (completion-all-sorted-completions))) (if (not (consp all)) (minibuffer-message (if all "No more completions" "No completions")) + (setq completion-cycling t) (goto-char end) (insert (car all)) (delete-region (+ start (cdr (last all))) end) From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 28 17:52:15 2010 Received: (at 7266) by debbugs.gnu.org; 28 Oct 2010 21:52:16 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBaOM-0004rG-QA for submit@debbugs.gnu.org; Thu, 28 Oct 2010 17:52:15 -0400 Received: from mail-yw0-f44.google.com ([209.85.213.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBa9W-0004ku-58 for 7266@debbugs.gnu.org; Thu, 28 Oct 2010 17:36:55 -0400 Received: by ywp6 with SMTP id 6so1667511ywp.3 for <7266@debbugs.gnu.org>; Thu, 28 Oct 2010 14:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Umcr6yedMlSKkIhr0FpWUqqM1hJbI1Qg24Kja10c0U4=; b=mDDQgS2JDhcYHHBuFgBuchY6N6kMSXMsEh9PZyKYi2vYHfXR7K+LhJy7dy6a6yZH9N bB5wavVvf8xCnCjxdjp6/EF1+3HkkFWgnU+4BUfFJrxByUVFkZerq8QXhq8XP73BceL1 E4F626HL46NaD2bODQDEhChbn08j9wJxMzDFQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=GSzA0QliWkwdbVAlb9LSUKB0sCw6l2yWiiECZjb9ra9eBKCTaLTvemH2zGaMqGkOBW edM+eiLHxQbM6zZNr5HlnCFmLHky/xWnf8bcBnrGV+VIKa/bt89eQGwHFE8EFex785Ke bajmQ7I/o/+hTO5aH99WQ+h+UIgDdOTm12qd0= Received: by 10.42.41.7 with SMTP id n7mr3771766ice.381.1288302064020; Thu, 28 Oct 2010 14:41:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.176.7 with HTTP; Thu, 28 Oct 2010 14:40:43 -0700 (PDT) In-Reply-To: References: From: Fran Litterio Date: Thu, 28 Oct 2010 17:40:43 -0400 Message-ID: Subject: Re: Patch to fix minibuffer-complete when icomplete-mode is on and completion-cycle-threshold is nil To: Stefan Monnier Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 7266 X-Mailman-Approved-At: Thu, 28 Oct 2010 17:52:14 -0400 Cc: 7266@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Wed, Oct 27, 2010 at 10:23 PM, Stefan Monnier wrote: >> 2. Type: ESC ESC : (icomplete-mode 1) RET C-h v mini TAB TAB > >> Notice that minibuffer-complete (which is bound to TAB at this point) >> is cycling through the completion choices instead of popping up a >> window to display the completion choices. > Thanks very much. =A0Indeed, there's a problem here, but... [...] > Hmm... AFAICT if completion-cycle-threshold is nil, then comps will also > be nil, so this change should not make any difference. Oddly, my change _did_ fix the problem for me. > It goes a bit further than that: even if completion-cycle-threshold is > non-nil and completion-all-sorted-completions is set, it may still be > wrong to call minibuffer-force-complete since > completion-all-sorted-completions may only be set because of icomplete > rather than because we're cycling (e.g. the completion list may be > larger than the threshold). > > So I've installed the patch below instead. =A0Please confirm that it fixe= s > the problem. I've verified that your patch does indeed fix the problem. Thanks, Stefan! -- Fran From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 30 22:06:08 2010 Received: (at control) by debbugs.gnu.org; 31 Oct 2010 02:06:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCNJA-0003Ul-8n for submit@debbugs.gnu.org; Sat, 30 Oct 2010 22:06:08 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCNJ8-0003UO-31 for control@debbugs.gnu.org; Sat, 30 Oct 2010 22:06:06 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1PCNNF-0005Es-99; Sat, 30 Oct 2010 22:10:21 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19660.53261.260706.634595@fencepost.gnu.org> Date: Sat, 30 Oct 2010 22:10:21 -0400 From: Glenn Morris To: control Subject: close 7266 X-Attribution: GM X-Mailer: VM (www.wonderworks.com/vm), GNU Emacs (www.gnu.org/software/emacs) X-Hue: yellow X-Ran: Rdvo.5]gwrr[*':1.?=!&52FFR9VU0*[7=)~Rq2nQqN-'s]HJH$a[:kFI(a|PxB"'?p^S; X-Debbugs-No-Ack: yes X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) close 7266 From unknown Sat Aug 16 10:45:18 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 28 Nov 2010 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator