summaryrefslogtreecommitdiff
path: root/lisp/kmacro.el
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2013-03-30 21:49:00 +0800
committerLeo Liu <sdl.web@gmail.com>2013-03-30 21:49:00 +0800
commit0b1619da55f7c2e958edd38684c9c30fa235059f (patch)
tree0a13917f591aa4fb56db146d49b9352a501e3d32 /lisp/kmacro.el
parent7c5ef69a98e3f282c116c56eb7b3fe22e5bd44ea (diff)
downloademacs-0b1619da55f7c2e958edd38684c9c30fa235059f.tar.gz
* etc/NEWS: Mention `kmacro-to-register' and new eldoc feature.
* lisp/kmacro.el (kmacro-call-macro): Add optional arg MACRO. (kmacro-execute-from-register): Pass the keyboard macro to kmacro-call-macro or repeating won't work correctly.
Diffstat (limited to 'lisp/kmacro.el')
-rw-r--r--lisp/kmacro.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 4253fb87d5c..c08f49df0a7 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -614,9 +614,10 @@ An argument of zero means repeat until error."
;;;###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 @@ others, use \\[kmacro-name-last-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 @@ others, use \\[kmacro-name-last-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 @@ Such a \"function\" cannot be called from Lisp, but it is a valid editor command
(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."
@@ -851,10 +852,10 @@ Such a \"function\" cannot be called from Lisp, but it is a valid editor command
last-kbd-macro
:jump-func 'kmacro-execute-from-register
:print-func (lambda (k)
- (princ (format "a keyboard macro:\n %s"
- (format-kbd-macro k))))
+ (princ (format "a keyboard macro:\n %s"
+ (format-kbd-macro k))))
:insert-func (lambda (k)
- (insert (format-kbd-macro k))))))
+ (insert (format-kbd-macro k))))))
(defun kmacro-view-macro (&optional _arg)