Next: , Previous: Keyboard Macros, Up: Keyboard Macros

17.2.1 Naming Keyboard Macros

Once you have defined a keyboard macro, you can bind it to a z key sequence with the Z K (calc-user-define-kbd-macro) command. This command prompts first for a key, then for a command name. For example, if you type C-x ( n <TAB> n <TAB> C-x ) you will define a keyboard macro which negates the top two numbers on the stack (<TAB> swaps the top two stack elements). Now you can type Z K n <RET> to define this keyboard macro onto the z n key sequence. The default command name (if you answer the second prompt with just the <RET> key as in this example) will be something like ‘calc-User-n’. The keyboard macro will now be available as both z n and M-x calc-User-n. You can backspace and enter a more descriptive command name if you wish.



The Z E (calc-user-define-edit) command on a key that has been defined by a keyboard macro tries to use the edmacro package edit the macro. Type C-c C-c to finish editing and update the definition stored on the key, or, to cancel the edit, kill the buffer with C-x k. The special characters RET, LFD, TAB, SPC, DEL, and NUL must be entered as these three character sequences, written in all uppercase, as must the prefixes C- and M-. Spaces and line breaks are ignored. Other characters are copied verbatim into the keyboard macro. Basically, the notation is the same as is used in all of this manual's examples, except that the manual takes some liberties with spaces: When we say ' [1 2 3] <RET>, we take it for granted that it is clear we really mean ' [1 <SPC> 2 <SPC> 3] <RET>.
