]> git.eshelyaron.com Git - emacs.git/commitdiff
Exit with no confirmation (RET) when register-use-preview
authorThierry Volpiatto <thievol@posteo.net>
Sun, 3 Dec 2023 14:21:50 +0000 (15:21 +0100)
committerThierry Volpiatto <thievol@posteo.net>
Fri, 8 Dec 2023 14:28:40 +0000 (15:28 +0100)
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.

lisp/register.el

index 46ec38821e557b6e1e1e4f4389f1cd3e55b37460..a38b531dfc945cc4673dea1381065069362ae498 100644 (file)
@@ -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 "")))