Commit 35710234 authored by Leo Liu's avatar Leo Liu

* kmacro.el (kmacro-to-register): New command.

(kmacro-execute-from-register): New function.
(kmacro-keymap): Bind to 'x'.

Fixes: debbugs:14071
parent efc0bb73
2013-03-29 Leo Liu <sdl.web@gmail.com>
* kmacro.el (kmacro-to-register): New command.
(kmacro-execute-from-register): New function.
(kmacro-keymap): Bind to 'x'. (Bug#14071)
2013-03-29 Stefan Monnier <monnier@iro.umontreal.ca>
* mpc.el: Use defvar-local and setq-local.
......
......@@ -202,6 +202,7 @@ macro to be executed before appending to it."
;; naming and binding
(define-key map "b" 'kmacro-bind-to-key)
(define-key map "n" 'kmacro-name-last-macro)
(define-key map "x" 'kmacro-to-register)
map)
"Keymap for keyboard macro commands.")
(defalias 'kmacro-keymap kmacro-keymap)
......@@ -836,6 +837,26 @@ Such a \"function\" cannot be called from Lisp, but it is a valid editor command
(put symbol 'kmacro t))
(defun kmacro-execute-from-register (k)
(let ((last-kbd-macro k))
(kmacro-call-macro current-prefix-arg)))
(defun kmacro-to-register (r)
"Store the last keyboard macro in register R."
(interactive
(progn
(or last-kbd-macro (error "No keyboard macro defined"))
(list (read-char "Save to register: "))))
(set-register r (registerv-make
last-kbd-macro
:jump-func 'kmacro-execute-from-register
:print-func (lambda (k)
(princ (format "a keyboard macro:\n %s"
(format-kbd-macro k))))
:insert-func (lambda (k)
(insert (format-kbd-macro k))))))
(defun kmacro-view-macro (&optional _arg)
"Display the last keyboard macro.
If repeated, it shows previous elements in the macro ring."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment