]> git.eshelyaron.com Git - emacs.git/commitdiff
(minibuffer-query-apply): Make sure not to skip first candidate
authorEshel Yaron <me@eshelyaron.com>
Sun, 9 Jun 2024 07:49:49 +0000 (09:49 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Jun 2024 07:49:49 +0000 (09:49 +0200)
lisp/minibuffer.el

index 11a28b9e5d655b3b305d843717892c29b6c9e42a..23fd69303ae0c98901f2a51ae62127a909fe5c90 100644 (file)
@@ -4408,9 +4408,11 @@ possible completions."
   "Suggest applying the minibuffer action to each completion candidate in turn."
   (interactive nil minibuffer-mode)
   (with-minibuffer-completions-window
-    (let ((prev (point))
-          all done)
+    (let (prev all done)
       (goto-char (point-min))
+      ;; Clear `first-completion' property from beginning of buffer such
+      ;; that first call to `minibuffer-next-completion' below "selects"
+      ;; the first completion, instead of moving forward to the second.
       (when (get-text-property (point) 'first-completion)
         (let ((inhibit-read-only t))
           (remove-text-properties (point) (1+ (point)) '(first-completion))))
@@ -4433,7 +4435,10 @@ possible completions."
                  (call-interactively #'minibuffer-apply)))
               (?n)                      ; Skip.
               (?q (setq done t))        ; Quit.
-              (?! (setq all ?y)))       ; Apply to all.
+              (?!                       ; Apply to all.
+               (with-current-buffer completion-reference-buffer
+                 (call-interactively #'minibuffer-apply))
+               (setq all ?y)))
           ;; We're back at the first candidate, stop.
           (setq done t)
           (message "Done"))))))