Subject: bug#4504: 23.1; [missing feature] `minibuffer-force-completion' does not cycle through completions

From: Stefan Monnier <[email-masked]>
Date: Wed, 23 Sep 2009 22:39:06 -0400

> 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    <[email-masked]> 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)