From caa22dda263134bba119da674b92992ee4dfd934 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 9 Jun 2024 09:49:49 +0200 Subject: [PATCH] (minibuffer-query-apply): Make sure not to skip first candidate --- lisp/minibuffer.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 11a28b9e5d6..23fd69303ae 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -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")))))) -- 2.39.2