Share your knowledge at the LQ Wiki.
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Emacs: Permanent Key Binding For Saved Macro
 Linux - Software This forum is for Software issues. Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

11-27-2009, 03:54 AM   #1
CoderMan
Member

Registered: Jan 2009
Location: Gemini Capsule 25164
Distribution: Gentoo
Posts: 375
Blog Entries: 24

Rep:
Emacs: Permanent Key Binding For Saved Macro

Hi. I would appreciate some help from the Emacs gurus. I was trying to follow an online tutorial on how to permanently save a macro for reuse. So I tried to follow the instructions, and ended up putting this in my .emacs:

Code:
(fset 'texquote
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("\\begin{quotation}^M^M^M^M\\end{quotation}^[OA^[OA" 0 "%d")) arg)))
This works great in that it makes available my macro as the "texquote" command, but it does not also make available the key-binding I attached to the command, which was "C-x C-k 1".

The tutorial says:

Quote:
 If you give insert-kbd-macro a numeric argument, it makes additional Lisp code to record the keys (if any) that you have bound to macroname, so that the macro will be reassigned the same keys when you load the file.
I think this is where I went wrong, but when I try to use "M-x insert-kdb-macro 1" it just says that there is no macro by that name. What does it mean then when it says to "give insert-kbd-macro a numeric argument"?

Last edited by CoderMan; 11-27-2009 at 03:55 AM.