diff lisp/kmacro.el @ 90016:ff0e824afa37

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-57 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-594 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-598 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-599 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-600 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-602 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-603 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-604 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-609 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-610 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-611 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-614 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-615 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-42 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-43 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-44 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-46 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-47 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-48 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-49 Add {arch}/=commit-merge-make-log * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-50 {arch}/=commit-merge-make-log: Don't die if there are no ChangeLog changes
author Miles Bader <miles@gnu.org>
date Thu, 14 Oct 2004 08:50:09 +0000
parents 58db929d96c6 e12200cc9b00
children e24e2e78deda
line wrap: on
line diff
--- a/lisp/kmacro.el	Wed Oct 13 02:40:50 2004 +0000
+++ b/lisp/kmacro.el	Thu Oct 14 08:50:09 2004 +0000
@@ -248,7 +248,9 @@
   "Insert macro counter and increment with ARG or 1 if missing.
 With \\[universal-argument], insert previous kmacro-counter (but do not modify counter)."
   (interactive "P")
-  (setq kmacro-initial-counter-value nil)
+  (if kmacro-initial-counter-value
+      (setq kmacro-counter kmacro-initial-counter-value
+	    kmacro-initial-counter-value nil))
   (if (and arg (listp arg))
       (insert (format kmacro-counter-format kmacro-last-counter))
     (insert (format kmacro-counter-format kmacro-counter))
@@ -275,23 +277,23 @@
   "Set kmacro-counter to ARG or prompt if missing.
 With \\[universal-argument] prefix, reset counter to its value prior to this iteration of the macro."
   (interactive "NMacro counter value: ")
-  (setq kmacro-last-counter kmacro-counter
-	kmacro-counter (if (and current-prefix-arg (listp current-prefix-arg))
-			   kmacro-counter-value-start
-			 arg))
-  ;; setup initial macro counter value if we are not executing a macro.
-  (setq kmacro-initial-counter-value
-	(and (not (or defining-kbd-macro executing-kbd-macro))
-	     kmacro-counter))
-  (unless executing-kbd-macro
-    (kmacro-display-counter)))
+  (if (not (or defining-kbd-macro executing-kbd-macro))
+      (kmacro-display-counter (setq kmacro-initial-counter-value arg))
+    (setq kmacro-last-counter kmacro-counter
+	  kmacro-counter (if (and current-prefix-arg (listp current-prefix-arg))
+			     kmacro-counter-value-start
+			   arg))
+    (unless executing-kbd-macro
+      (kmacro-display-counter))))
 
 
 (defun kmacro-add-counter (arg)
   "Add numeric prefix arg (prompt if missing) to macro counter.
 With \\[universal-argument], restore previous counter value."
   (interactive "NAdd to macro counter: ")
-  (setq kmacro-initial-counter-value nil)
+  (if kmacro-initial-counter-value
+      (setq kmacro-counter kmacro-initial-counter-value
+	    kmacro-initial-counter-value nil))
   (let ((last kmacro-last-counter))
     (setq kmacro-last-counter kmacro-counter
 	  kmacro-counter (if (and current-prefix-arg (listp current-prefix-arg))
@@ -394,7 +396,10 @@
 	     (m (format-kbd-macro macro))
 	     (l (length m))
 	     (z (and nil trunc (> l x))))
-	(message (format "%s: %s%s" (or descr "Macro")
+	(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 "..." ""))))
     (message (or empty "No keyboard macros defined"))))