emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kmacro-to-register


From: Leo Liu
Subject: Re: kmacro-to-register
Date: Sat, 30 Mar 2013 17:56:24 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3)

On 2013-03-30 17:19 +0800, Bastien wrote:
> it will first call the macro stored in ?a then called the macro
> stored with the previous C-x ( call, instead of repeating the 
> macro stored in ?a.
>
> Thanks in advance for fixing this!

Thank you for catching the bug.

kmacro-call-macro isn't provisioned for our use case. Could you try the
following patch?

diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 4253fb87..5dfadea2 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -614,9 +614,10 @@ (defun kmacro-end-macro (arg)
 
 
 ;;;###autoload
-(defun kmacro-call-macro (arg &optional no-repeat end-macro)
-  "Call the last keyboard macro that you defined with \\[kmacro-start-macro].
+(defun kmacro-call-macro (arg &optional no-repeat end-macro macro)
+  "Call the keyboard MACRO that you defined with \\[kmacro-start-macro].
 A prefix argument serves as a repeat count.  Zero means repeat until error.
+MACRO defaults to `last-kbd-macro'.
 
 When you call the macro, you can call the macro again by repeating
 just the last key in the key sequence that you used to call this
@@ -630,7 +631,8 @@ (defun kmacro-call-macro (arg &optional no-repeat end-macro)
                                   (> (length (this-single-command-keys)) 1))
                              ;; Used when we're in the process of repeating.
                              (eq no-repeat 'repeating))
-                        last-input-event)))
+                        last-input-event))
+       (last-kbd-macro (or macro last-kbd-macro)))
     (if end-macro
        (kmacro-end-macro arg)
       (call-last-kbd-macro arg #'kmacro-loop-setup-function))
@@ -656,7 +658,7 @@ (defun kmacro-call-macro (arg &optional no-repeat end-macro)
          (define-key map (vector repeat-key)
            `(lambda () (interactive)
               (kmacro-call-macro ,(and kmacro-call-repeat-with-arg arg)
-                                 'repeating)))
+                                 'repeating nil ,last-kbd-macro)))
          map)))))
 
 
@@ -838,8 +840,7 @@ (defun kmacro-name-last-macro (symbol)
 
 
 (defun kmacro-execute-from-register (k)
-  (let ((last-kbd-macro k))
-    (kmacro-call-macro current-prefix-arg)))
+  (kmacro-call-macro current-prefix-arg nil nil k))
 
 (defun kmacro-to-register (r)
   "Store the last keyboard macro in register R."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]