comparison lisp/kmacro.el @ 58718:9a437a7c791c

(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'.
author Luc Teirlinck <teirllm@auburn.edu>
date Thu, 02 Dec 2004 00:17:54 +0000
parents b017a1c31a53
children aac0a33f5772 f2ebccfa87d4
comparison
equal deleted inserted replaced
58717:bd9d0c90fd28 58718:9a437a7c791c
234 234
235 ;;; Keyboard macro counter 235 ;;; Keyboard macro counter
236 236
237 (defvar kmacro-counter 0 237 (defvar kmacro-counter 0
238 "*Current keyboard macro counter.") 238 "*Current keyboard macro counter.")
239
240 (defvar kmacro-default-counter-format "%d")
239 241
240 (defvar kmacro-counter-format "%d" 242 (defvar kmacro-counter-format "%d"
241 "*Current keyboard macro counter format.") 243 "*Current keyboard macro counter format.")
242 244
243 (defvar kmacro-counter-format-start kmacro-counter-format 245 (defvar kmacro-counter-format-start kmacro-counter-format
266 (kmacro-add-counter (prefix-numeric-value arg)))) 268 (kmacro-add-counter (prefix-numeric-value arg))))
267 269
268 270
269 (defun kmacro-set-format (format) 271 (defun kmacro-set-format (format)
270 "Set macro counter FORMAT." 272 "Set macro counter FORMAT."
271 (interactive "sMacro Counter Format (printf format): ") 273 (interactive "sMacro Counter Format: ")
272 (setq kmacro-counter-format 274 (setq kmacro-counter-format
273 (if (equal format "") "%d" format)) 275 (if (equal format "") "%d" format))
274 ;; redefine initial macro counter if we are not executing a macro. 276 ;; redefine initial macro counter if we are not executing a macro.
275 (if (not (or defining-kbd-macro executing-kbd-macro)) 277 (if (not (or defining-kbd-macro executing-kbd-macro))
276 (setq kmacro-counter-format-start kmacro-counter-format))) 278 (setq kmacro-default-counter-format kmacro-counter-format)))
277 279
278 280
279 (defun kmacro-display-counter (&optional value) 281 (defun kmacro-display-counter (&optional value)
280 "Display current counter value." 282 "Display current counter value."
281 (unless value (setq value kmacro-counter)) 283 (unless value (setq value kmacro-counter))
402 Optional arg EMPTY is message to print if no macros are defined." 404 Optional arg EMPTY is message to print if no macros are defined."
403 (if macro 405 (if macro
404 (let* ((x 60) 406 (let* ((x 60)
405 (m (format-kbd-macro macro)) 407 (m (format-kbd-macro macro))
406 (l (length m)) 408 (l (length m))
407 (z (and nil trunc (> l x)))) 409 (z (and trunc (> l x))))
408 (message (format "%s%s: %s%s" (or descr "Macro") 410 (message "%s%s: %s%s" (or descr "Macro")
409 (if (= kmacro-counter 0) "" 411 (if (= kmacro-counter 0) ""
410 (format " [%s]" 412 (format " [%s]"
411 (format kmacro-counter-format-start kmacro-counter))) 413 (format kmacro-counter-format-start kmacro-counter)))
412 (if z (substring m 0 (1- x)) m) (if z "..." "")))) 414 (if z (substring m 0 (1- x)) m) (if z "..." "")))
413 (message (or empty "No keyboard macros defined")))) 415 (message (or empty "No keyboard macros defined"))))
414 416
415 417
416 (defun kmacro-repeat-on-last-key (keys) 418 (defun kmacro-repeat-on-last-key (keys)
417 "Process kmacro commands keys immidiately after cycling the ring." 419 "Process kmacro commands keys immidiately after cycling the ring."
586 kmacro-initial-counter-value 588 kmacro-initial-counter-value
587 0) 589 0)
588 kmacro-initial-counter-value nil 590 kmacro-initial-counter-value nil
589 kmacro-counter-value-start kmacro-counter 591 kmacro-counter-value-start kmacro-counter
590 kmacro-last-counter kmacro-counter 592 kmacro-last-counter kmacro-counter
591 kmacro-counter-format-start kmacro-counter-format)) 593 kmacro-counter-format kmacro-default-counter-format
594 kmacro-counter-format-start kmacro-default-counter-format))
592 595
593 (start-kbd-macro append 596 (start-kbd-macro append
594 (and append 597 (and append
595 (if kmacro-execute-before-append 598 (if kmacro-execute-before-append
596 (> (car arg) 4) 599 (> (car arg) 4)