From: Eshel Yaron Date: Sun, 9 Jun 2024 07:49:49 +0000 (+0200) Subject: (minibuffer-query-apply): Make sure not to skip first candidate X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=caa22dda263134bba119da674b92992ee4dfd934;p=emacs.git (minibuffer-query-apply): Make sure not to skip first candidate --- 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"))))))