From: Thierry Volpiatto Date: Sun, 3 Dec 2023 14:21:50 +0000 (+0100) Subject: Exit with no confirmation (RET) when register-use-preview X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8e52a59808e9ca1b8e535725eb76b83e409745eb;p=emacs.git Exit with no confirmation (RET) when register-use-preview is non nil and . This is done by exiting minibuffer when selected register is empty or when just jumping or inserting. * lisp/register.el (register-read-with-preview): Do it. --- diff --git a/lisp/register.el b/lisp/register.el index 46ec38821e5..a38b531dfc9 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -385,12 +385,16 @@ display such a window regardless." (minibuffer-message "Register `%s' is empty" pat)))))) (unless (string= pat "") - (if (member pat strs) - (with-selected-window (minibuffer-window) - (minibuffer-message msg pat)) - (with-selected-window (minibuffer-window) - (minibuffer-message - "Register `%s' is empty" pat))))))))) + (with-selected-window (minibuffer-window) + (if (and (member pat strs) (memq act '(set modify))) + (with-selected-window (minibuffer-window) + (minibuffer-message msg pat)) + ;; An empty register or an existing + ;; one but the action is insert or + ;; jump, don't ask for confirmation + ;; and exit immediately (bug#66394). + (setq result pat) + (exit-minibuffer))))))))) (setq result (read-from-minibuffer prompt nil map nil nil (register-preview-get-defaults act)))) (cl-assert (and result (not (string= result "")))