[Top][All Lists]

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


From: Leo Liu
Subject: kmacro-to-register
Date: Tue, 26 Mar 2013 11:28:05 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3)

Hi there,

I am thinking of adding a command kmacro-to-register which would allow
one to store kmacros in registers. Not a heavy user of kmacros I am
interested in knowing if this is generally useful.

I am undecided about the action to take for jump to such a register:

  Option 1: restore the kmacro in the register as current
  Option 2: just play the kmacro in the register

Sample code:

(define-key kmacro-keymap "x" 'kmacro-to-register)

(defun kmacro-to-register (r)
  "Store last keyboard macro in a register R."
  (interactive "cLast keyboard macro to register: ")
  (set-register r (registerv-make
                   :jump-func (lambda (v)
                                (let ((last-kbd-macro v))
                   :print-func (lambda (v)
                                 (princ (format "a keyboard macro:\n   %s"
                                                (format-kbd-macro v))))
                   :insert-func (lambda (v)
                                  (insert (format-kbd-macro v))))))


reply via email to

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