From 68d87cd978f86e706abdd3847ba7df94f49554fe Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 2 Jun 2024 13:14:37 +0200 Subject: [PATCH] Adapt last addition to kmacro.el --- lisp/kmacro.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 0276b8b968d..ed6ce42815b 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -357,7 +357,8 @@ information." (defun kmacro-reg-load-counter (register) "Load the value of a REGISTER into `kmacro-counter'." (interactive - (list (register-read-with-preview "Load register to counter: "))) + (list (register-read-with-preview "Load register to counter: " + nil #'numberp))) (let ((register-val (get-register register))) (when (numberp register-val) (setq kmacro-counter register-val)))) @@ -365,7 +366,8 @@ information." (defun kmacro-reg-save-counter (register) "Save the value of `kmacro-counter' to a REGISTER." (interactive - (list (register-read-with-preview "Save counter to register: "))) + (list (register-read-with-preview "Save counter to register: " + (register-confirm-overwrite)))) (set-register register kmacro-counter)) (defun kmacro-reg-add-counter-equal (&optional arg) @@ -373,7 +375,8 @@ information." Optional non-nil ARG specifies the increment." (interactive "p") (let - ((register (register-read-with-preview "Compare counter to register: "))) + ((register (register-read-with-preview "Compare counter to register: " + nil #'numberp))) (kmacro-reg-add-counter #'= register arg))) (defun kmacro-reg-add-counter-less (&optional arg) @@ -381,7 +384,8 @@ Optional non-nil ARG specifies the increment." Optional non-nil ARG specifies increment." (interactive "p") (let - ((register (register-read-with-preview "Compare counter to register: "))) + ((register (register-read-with-preview "Compare counter to register: " + nil #'numberp))) (kmacro-reg-add-counter #'< register arg))) @@ -390,16 +394,15 @@ Optional non-nil ARG specifies increment." Optional non-nil ARG specifies increment." (interactive "p") (let - ((register (register-read-with-preview "Compare counter to register: "))) + ((register (register-read-with-preview "Compare counter to register: " + nil #'numberp))) (kmacro-reg-add-counter #'> register arg))) (defun kmacro-reg-add-counter (pred register arg) "Increment `kmacro-counter' by ARG if PRED returns non-nil. PRED is called with two arguments: `kmacro-counter' and REGISTER." - (let ((register-val (get-register register))) - (when (funcall pred kmacro-counter register-val) - (setq current-prefix-arg nil) - (kmacro-add-counter arg)))) + (when (funcall pred kmacro-counter (get-register register)) + (kmacro-add-counter arg))) (defun kmacro-quit-counter-equal (&optional arg) "Quit the keyboard macro if the counter is equal to ARG. @@ -426,8 +429,7 @@ ARG defaults to zero if it is nil." (when kmacro-initial-counter-value (setq kmacro-counter kmacro-initial-counter-value kmacro-initial-counter-value nil)) - (let ((arg (if (null current-prefix-arg) - 0 arg))) + (let ((arg (or arg 0))) (when (funcall pred kmacro-counter arg) (keyboard-quit)))) -- 2.39.2