From unknown Tue Jun 17 20:07:56 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#4504 <4504@debbugs.gnu.org> To: bug#4504 <4504@debbugs.gnu.org> Subject: Status: 23.1; [missing feature] `minibuffer-force-completion' does not cycle through completions Reply-To: bug#4504 <4504@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:07:56 +0000 retitle 4504 23.1; [missing feature] `minibuffer-force-completion' does not= cycle through completions reassign 4504 emacs submitter 4504 Bruno Barbier severity 4504 normal thanks From bruno.barbier.cs@orange.fr Mon Sep 21 07:42:53 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 21 Sep 2009 14:42:54 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA,FVGT_m_MULTI_ODD, MURPHY_DRUGS_REL8 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8LEgqes019751 for ; Mon, 21 Sep 2009 07:42:53 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mpk6O-0003tb-0M for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 10:42:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mpk6I-0003tB-JH for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 10:42:50 -0400 Received: from [199.232.76.173] (port=60777 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mpk6I-0003t8-Ck for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 10:42:46 -0400 Received: from mx20.gnu.org ([199.232.41.8]:63401) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mpk6H-0006UZ-Tu for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 10:42:46 -0400 Received: from smtp2f.orange.fr ([80.12.242.152]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mpk6G-0001bt-4l for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2009 10:42:44 -0400 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2f21.orange.fr (SMTP Server) with ESMTP id 34E598000041 for ; Mon, 21 Sep 2009 16:42:37 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2f21.orange.fr (SMTP Server) with ESMTP id 28FDA80000A6 for ; Mon, 21 Sep 2009 16:42:37 +0200 (CEST) Received: from orange.fr (ADijon-258-1-78-183.w90-13.abo.wanadoo.fr [90.13.61.183]) by mwinf2f21.orange.fr (SMTP Server) with SMTP id AA23A800004A for ; Mon, 21 Sep 2009 16:42:36 +0200 (CEST) X-ME-UUID: 20090921144236696.AA23A800004A@mwinf2f21.orange.fr Received: by orange.fr (nbSMTP-1.00) for uid 1000 bruno.barbier.cs@orange.fr; Mon, 21 Sep 2009 16:20:16 +0200 (CEST) Date: Mon, 21 Sep 2009 16:20:16 +0200 From: Bruno Barbier To: bug-gnu-emacs@gnu.org Subject: 23.1; [missing feature] `minibuffer-force-completion' does not cycle through completions Message-ID: <20090921142016.GA4717@mycomputer> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Problem The function `minibuffer-force-complete' does not cycle through completions; it just steps through the completion list once. * Step to reproduce: 1. In a shell emacs -Q --eval "(progn \ (define-key minibuffer-local-completion-map \ (kbd \"M-\" ) \ #'minibuffer-force-complete) \ (setq unread-command-events \ (append '(?\M-x ?s ?e ?t ?- ?v) \ '(tab M-tab M-tab) \ unread-command-events )) \ ) \ " 2. Hit M- * Result M- offers only "set-visited-file-name" as the sole completion. * Expected result M- should allow cycling through the choices: set-variable set-visited-file-name * Proposed solution See attached patch against today CVS version ([2009-09-21 Mon]). * Proposed ChangeLog item if needed. 2009-09-21 or whoever commits it * minibuffer.el: The function `minibuffer-force-complete' now cycles through the completion choices (it was just stepping through the completion list once). --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="minibuffer.el.patch" *** emacs/lisp/minibuffer.el Wed Sep 2 05:09:19 2009 --- patched-emacs/lisp/minibuffer.el Mon Sep 21 15:40:24 2009 *************** *** 528,536 **** (setq completion-all-sorted-completions (nconc all base-size)))))) (defun minibuffer-force-complete () "Complete the minibuffer to an exact match. ! Repeated uses step through the possible completions." (interactive) ;; FIXME: Need to deal with the extra-size issue here as well. (let* ((start (field-beginning)) --- 528,576 ---- (setq completion-all-sorted-completions (nconc all base-size)))))) + (defun minibuffer--rotate-completions (l) + "Rotate the list of completions L. + + The first element becomes the last one. More precisely: + (minibuffer--rotate-completions '(c1 c2 .. c_{n-1} cn . basesize)) + ==> + (cn c1 c2 .. c_{n-1} . basesize)" + (if (not l) l + (let* ( ;; The first pair of the final result. We will set its elements + ;; when we meet them. + (result (cons nil nil)) + ;; The current pair we are building. + (now result) + ;; The tail of the completions we want to rotate. + (tail (cdr l)) + ) + ;; We copy until the last pair. + (while (consp tail) + (let ((next (cons (car l) nil)) + ) + ;; make `now' points to next and shift to next. + (setcdr now next) + (setq now next) + ;; update what we want to rotate on. + (setq l tail) + (setq tail (cdr l)) + )) + ;; Tail is the final element: it is basesize or nil, + ;; l is the last pair and its car is the last completion item. + (setcar result (car l)) + (setcdr now (cdr l)) + result) + )) + ;; @TEST with basesize: (minibuffer--rotate-completions '(1 2 3 . 4)) + ;; ==> (3 1 2 . 4) + ;; @TEST no basesize: (minibuffer--rotate-completions '(1 2 3 4)) + ;; ==> (4 1 2 3) + ;; @TEST limit case: (minibuffer--rotate-completions '()) + ;; ==> nil + (defun minibuffer-force-complete () "Complete the minibuffer to an exact match. ! Repeated uses cycle through the possible completions." (interactive) ;; FIXME: Need to deal with the extra-size issue here as well. (let* ((start (field-beginning)) *************** *** 546,552 **** ;; completion-all-sorted-completions to nil, but we prefer not to, ;; so that repeated calls minibuffer-force-complete still cycle ;; through the previous possible completions. ! (setq completion-all-sorted-completions (cdr all))))) (defvar minibuffer-confirm-exit-commands '(minibuffer-complete minibuffer-complete-word PC-complete PC-complete-word) --- 586,594 ---- ;; completion-all-sorted-completions to nil, but we prefer not to, ;; so that repeated calls minibuffer-force-complete still cycle ;; through the previous possible completions. ! (setq completion-all-sorted-completions ! (minibuffer--rotate-completions all)) ! ))) (defvar minibuffer-confirm-exit-commands '(minibuffer-complete minibuffer-complete-word PC-complete PC-complete-word) --M9NhX3UHpAaciwkO-- From monnier@iro.umontreal.ca Wed Sep 23 19:39:15 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 24 Sep 2009 02:39:15 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,FVGT_m_MULTI_ODD, HAS_BUG_NUMBER,MURPHY_DRUGS_REL8 autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8O2dDrk012917 for ; Wed, 23 Sep 2009 19:39:15 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqeEj-0006ks-6B for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2009 22:39:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqeEe-0006eh-6p for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2009 22:39:12 -0400 Received: from [199.232.76.173] (port=59605 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqeEe-0006ee-0a for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2009 22:39:08 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:37459 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqeEd-0006ST-Hh for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2009 22:39:07 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar4EAN94ukpFpYEz/2dsb2JhbACBUdRqhBsFh34 X-IronPort-AV: E=Sophos;i="4.44,442,1249272000"; d="scan'208";a="46463474" Received: from 69-165-129-51.dsl.teksavvy.com (HELO pastel.home) ([69.165.129.51]) by ironport2-out.pppoe.ca with ESMTP; 23 Sep 2009 22:39:06 -0400 Received: by pastel.home (Postfix, from userid 20848) id 9B11F807A; Wed, 23 Sep 2009 22:39:06 -0400 (EDT) From: Stefan Monnier To: Bruno Barbier Cc: 4504@debbugs.gnu.org, bug-gnu-emacs@gnu.org Subject: Re: bug#4504: 23.1; [missing feature] `minibuffer-force-completion' does not cycle through completions Message-ID: References: <20090921142016.GA4717@mycomputer> Date: Wed, 23 Sep 2009 22:39:06 -0400 In-Reply-To: <20090921142016.GA4717@mycomputer> (Bruno Barbier's message of "Mon, 21 Sep 2009 16:20:16 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. > The function `minibuffer-force-complete' does not cycle > through completions; it just steps through the completion list once. Indeed. > See attached patch against today CVS version ([2009-09-21 Mon]). Thank you. I've installed a simpler patch (see below) that makes use of the `last' function. > 2009-09-21 or whoever commits it Actually, this part of the changelog should list the author of the patch, not the person who committed it. Stefan Index: lisp/minibuffer.el =================================================================== RCS file: /sources/emacs/emacs/lisp/minibuffer.el,v retrieving revision 1.83 diff -u -r1.83 minibuffer.el --- lisp/minibuffer.el 2 Sep 2009 03:09:19 -0000 1.83 +++ lisp/minibuffer.el 24 Sep 2009 02:37:30 -0000 @@ -546,7 +546,9 @@ ;; completion-all-sorted-completions to nil, but we prefer not to, ;; so that repeated calls minibuffer-force-complete still cycle ;; through the previous possible completions. - (setq completion-all-sorted-completions (cdr all))))) + (let ((last (last all))) + (setcdr last (cons (car all) (cdr last))) + (setq completion-all-sorted-completions (cdr all)))))) (defvar minibuffer-confirm-exit-commands '(minibuffer-complete minibuffer-complete-word PC-complete PC-complete-word) From bruno.barbier.cs@orange.fr Thu Sep 24 01:13:53 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 24 Sep 2009 08:13:54 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.2 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8O8DpxZ005540 for ; Thu, 24 Sep 2009 01:13:53 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqjSZ-0007m7-CB for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 04:13:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqjSU-0007kU-RF for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 04:13:50 -0400 Received: from [199.232.76.173] (port=35144 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqjSU-0007kO-0w for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 04:13:46 -0400 Received: from smtp2e.orange.fr ([80.12.242.113]:12896) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqjST-0000Cc-LP for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 04:13:45 -0400 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2e24.orange.fr (SMTP Server) with ESMTP id 23F0380000BF; Thu, 24 Sep 2009 10:13:44 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2e24.orange.fr (SMTP Server) with ESMTP id 1717C80000E6; Thu, 24 Sep 2009 10:13:44 +0200 (CEST) Received: from orange.fr (ADijon-258-1-105-187.w90-13.abo.wanadoo.fr [90.13.104.187]) by mwinf2e24.orange.fr (SMTP Server) with SMTP id A9ECA80000BF; Thu, 24 Sep 2009 10:13:43 +0200 (CEST) X-ME-UUID: 20090924081343696.A9ECA80000BF@mwinf2e24.orange.fr Received: by orange.fr (nbSMTP-1.00) for uid 1000 bruno.barbier.cs@orange.fr; Thu, 24 Sep 2009 09:51:15 +0200 (CEST) Date: Thu, 24 Sep 2009 09:51:14 +0200 From: Bruno Barbier To: Stefan Monnier Cc: 4504@debbugs.gnu.org, bug-gnu-emacs@gnu.org Subject: Re: bug#4504: 23.1; [missing feature] `minibuffer-force-completion' does not cycle through completions Message-ID: <20090924075114.GA5313@mycomputer> References: <20090921142016.GA4717@mycomputer> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. On Wed, Sep 23, 2009 at 10:39:06PM -0400, Stefan Monnier wrote: > > Thank you. I've installed a simpler patch (see below) that makes use of > the `last' function. > Great. It's simpler and it works. Thank you. Bruno From monnier@iro.umontreal.ca Thu Sep 24 08:07:46 2009 Received: (at 4504-done) by emacsbugs.donarmstrong.com; 24 Sep 2009 15:07:46 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.181]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8OF7i9O001845 for <4504-done@emacsbugs.donarmstrong.com>; Thu, 24 Sep 2009 08:07:46 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqIEAKwou0pFpZBo/2dsb2JhbACBUtV0hBsFh34 X-IronPort-AV: E=Sophos;i="4.44,445,1249272000"; d="scan'208";a="46500294" Received: from 69-165-144-104.dsl.teksavvy.com (HELO ceviche.home) ([69.165.144.104]) by ironport2-out.pppoe.ca with ESMTP; 24 Sep 2009 11:07:24 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 5AD55B40F8; Thu, 24 Sep 2009 11:07:24 -0400 (EDT) From: Stefan Monnier To: Bruno Barbier Subject: Re: bug#4504: 23.1; [missing feature] `minibuffer-force-completion' does not cycle through completions Message-ID: References: <20090921142016.GA4717@mycomputer> <20090924075114.GA5313@mycomputer> Date: Thu, 24 Sep 2009 11:07:24 -0400 In-Reply-To: <20090924075114.GA5313@mycomputer> (Bruno Barbier's message of "Thu, 24 Sep 2009 09:51:14 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >> Thank you. I've installed a simpler patch (see below) that makes use of >> the `last' function. > Great. It's simpler and it works. > Thank you. Thanks for confirming, Stefan From unknown Tue Jun 17 20:07:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 23 Oct 2009 14:24:11 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator