From 7dcb2dfd8acf9c453f746a3b76fcd12aa2119ed8 Mon Sep 17 00:00:00 2001 From: Luc Teirlinck Date: Thu, 2 Dec 2004 00:17:54 +0000 Subject: (kmacro-default-counter-format): New var. (kmacro-set-format): Use it. Delete `(printf format)' from prompt. (kmacro-display): Remove `nil' from `and' form. Delete call to `format' inside `message'. (kmacro-start-macro): Use `kmacro-default-counter-format'. --- lisp/kmacro.el | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'lisp/kmacro.el') diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 9ee34a8432..3f4ff73177 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -237,6 +237,8 @@ macro to be executed before appending to it." (defvar kmacro-counter 0 "*Current keyboard macro counter.") +(defvar kmacro-default-counter-format "%d") + (defvar kmacro-counter-format "%d" "*Current keyboard macro counter format.") @@ -268,12 +270,12 @@ With \\[universal-argument], insert previous kmacro-counter (but do not modify c (defun kmacro-set-format (format) "Set macro counter FORMAT." - (interactive "sMacro Counter Format (printf format): ") + (interactive "sMacro Counter Format: ") (setq kmacro-counter-format (if (equal format "") "%d" format)) ;; redefine initial macro counter if we are not executing a macro. (if (not (or defining-kbd-macro executing-kbd-macro)) - (setq kmacro-counter-format-start kmacro-counter-format))) + (setq kmacro-default-counter-format kmacro-counter-format))) (defun kmacro-display-counter (&optional value) @@ -404,12 +406,12 @@ Optional arg EMPTY is message to print if no macros are defined." (let* ((x 60) (m (format-kbd-macro macro)) (l (length m)) - (z (and nil trunc (> l x)))) - (message (format "%s%s: %s%s" (or descr "Macro") - (if (= kmacro-counter 0) "" - (format " [%s]" - (format kmacro-counter-format-start kmacro-counter))) - (if z (substring m 0 (1- x)) m) (if z "..." "")))) + (z (and trunc (> l x)))) + (message "%s%s: %s%s" (or descr "Macro") + (if (= kmacro-counter 0) "" + (format " [%s]" + (format kmacro-counter-format-start kmacro-counter))) + (if z (substring m 0 (1- x)) m) (if z "..." ""))) (message (or empty "No keyboard macros defined")))) @@ -588,7 +590,8 @@ Use \\[kmacro-bind-to-key] to bind it to a key sequence." kmacro-initial-counter-value nil kmacro-counter-value-start kmacro-counter kmacro-last-counter kmacro-counter - kmacro-counter-format-start kmacro-counter-format)) + kmacro-counter-format kmacro-default-counter-format + kmacro-counter-format-start kmacro-default-counter-format)) (start-kbd-macro append (and append -- cgit v1.2.3