Mercurial > emacs
annotate man/kmacro.texi @ 52224:57534ab575bd
New file describing enhanced keyboard macro functionality.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sun, 17 Aug 2003 22:10:38 +0000 |
parents | |
children | b82089993b78 |
rev | line source |
---|---|
52224
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
1 @c This is part of the Emacs manual. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
2 @c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002,2003 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
3 @c Free Software Foundation, Inc. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
4 @c See file emacs.texi for copying conditions. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
5 @node Keyboard Macros, Files, Fixit, Top |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
6 @chapter Keyboard Macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
7 @cindex defining keyboard macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
8 @cindex keyboard macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
9 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
10 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
11 @node Keyboard Macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
12 @section Keyboard Macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
13 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
14 @cindex defining keyboard macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
15 @cindex keyboard macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
16 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
17 In this chapter we describe how a sequence of editing commands can |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
18 be recorded and repeated multiple times. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
19 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
20 A @dfn{keyboard macro} is a command defined by the user to stand for |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
21 another sequence of keys. For example, if you discover that you are |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
22 about to type @kbd{C-n C-d} forty times, you can speed your work by |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
23 defining a keyboard macro to do @kbd{C-n C-d} and calling it with a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
24 repeat count of forty. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
25 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
26 You define a keyboard macro while executing the commands which are the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
27 definition. Put differently, as you define a keyboard macro, the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
28 definition is being executed for the first time. This way, you can see |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
29 what the effects of your commands are, so that you don't have to figure |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
30 them out in your head. When you are finished, the keyboard macro is |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
31 defined and also has been, in effect, executed once. You can then do the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
32 whole thing over again by invoking the macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
33 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
34 Keyboard macros differ from ordinary Emacs commands in that they are |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
35 written in the Emacs command language rather than in Lisp. This makes it |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
36 easier for the novice to write them, and makes them more convenient as |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
37 temporary hacks. However, the Emacs command language is not powerful |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
38 enough as a programming language to be useful for writing anything |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
39 intelligent or general. For such things, Lisp must be used. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
40 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
41 @menu |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
42 * Basic Keyboard Macro:: Defining and running keyboard macros. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
43 * Keyboard Macro Ring:: Where previous keyboard macros are saved. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
44 * Keyboard Macro Counter:: Inserting incrementing numbers in macros. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
45 * Keyboard Macro Query:: Making keyboard macros do different things each time. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
46 * Save Keyboard Macro:: Giving keyboard macros names; saving them in files. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
47 * Edit Keyboard Macro:: Editing keyboard macros. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
48 * Keyboard Macro Step-Edit:: Interactively executing and editing a keyboard macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
49 @end menu |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
50 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
51 @node Basic Keyboard Macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
52 @section Basic Use |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
53 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
54 @table @kbd |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
55 @item C-x ( |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
56 Start defining a keyboard macro (@code{kmacro-start-macro}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
57 @item C-x ) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
58 End the definition of a keyboard macro (@code{kmacro-end-macro}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
59 @item C-x e |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
60 Execute the most recent keyboard macro (@code{kmacro-end-and-call-macro}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
61 First end the definition of the keyboard macro, if currently defining it. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
62 To immediately execute the keyboard macro again, just repeat the @kbd{e}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
63 @item C-u C-x ( |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
64 Re-execute last keyboard macro, then add more keys to its definition. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
65 @item C-u C-u C-x ( |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
66 Add more keys to the last keyboard macro without re-executing it. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
67 @item C-x q |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
68 When this point is reached during macro execution, ask for confirmation |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
69 (@code{kbd-macro-query}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
70 @item C-x C-k n |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
71 Give a command name (for the duration of the session) to the most |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
72 recently defined keyboard macro (@code{name-last-kbd-macro}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
73 @item C-x C-k b |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
74 Bind the most recently defined keyboard macro to a key sequence (for |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
75 the duration of the session) (@code{kmacro-bind-to-key}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
76 @item M-x insert-kbd-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
77 Insert in the buffer a keyboard macro's definition, as Lisp code. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
78 @item C-x C-k e |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
79 Edit a previously defined keyboard macro (@code{edit-kbd-macro}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
80 @item C-x C-k r |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
81 Run the last keyboard macro on each complete line in the region |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
82 (@code{apply-macro-to-region-lines}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
83 @end table |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
84 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
85 @kindex C-x ( |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
86 @kindex C-x ) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
87 @kindex C-x e |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
88 @findex kmacro-start-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
89 @findex kmacro-end-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
90 @findex kmacro-end-and-call-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
91 To start defining a keyboard macro, type the @kbd{C-x (} command |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
92 (@code{kmacro-start-macro}). From then on, your keys continue to be |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
93 executed, but also become part of the definition of the macro. @samp{Def} |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
94 appears in the mode line to remind you of what is going on. When you are |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
95 finished, the @kbd{C-x )} command (@code{kmacro-end-macro}) terminates the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
96 definition (without becoming part of it!). For example, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
97 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
98 @example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
99 C-x ( M-f foo C-x ) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
100 @end example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
101 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
102 @noindent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
103 defines a macro to move forward a word and then insert @samp{foo}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
104 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
105 The macro thus defined can be invoked again with the @kbd{C-x e} |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
106 command (@code{kmacro-end-and-call-macro}), which may be given a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
107 repeat count as a numeric argument to execute the macro many times. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
108 If you enter @kbd{C-x e} while defining a macro, the macro is |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
109 terminated and executed immediately. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
110 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
111 After executing the macro with @kbd{C-x e}, you can use @kbd{e} |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
112 repeatedly to immediately repeat the macro one or more times. For example, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
113 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
114 @example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
115 C-x ( xyz C-x e e e |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
116 @end example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
117 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
118 @noindent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
119 inserts @samp{xyzxyzxyzxyz} in the current buffer. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
120 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
121 @kbd{C-x )} can also be given a repeat count as an argument, in |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
122 which case it repeats the macro that many times right after defining |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
123 it, but defining the macro counts as the first repetition (since it is |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
124 executed as you define it). Therefore, giving @kbd{C-x )} an argument |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
125 of 4 executes the macro immediately 3 additional times. An argument |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
126 of zero to @kbd{C-x e} or @kbd{C-x )} means repeat the macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
127 indefinitely (until it gets an error or you type @kbd{C-g} or, on |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
128 MS-DOS, @kbd{C-@key{BREAK}}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
129 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
130 @kindex C-x C-k C-s |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
131 @kindex C-x C-k C-k |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
132 Alternatively, you can use @kbd{C-x C-k C-s} to start a keyboard macro, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
133 and @kbd{C-x C-k C-k...} to end and execute it. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
134 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
135 If you wish to repeat an operation at regularly spaced places in the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
136 text, define a macro and include as part of the macro the commands to move |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
137 to the next place you want to use it. For example, if you want to change |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
138 each line, you should position point at the start of a line, and define a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
139 macro to change that line and leave point at the start of the next line. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
140 Then repeating the macro will operate on successive lines. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
141 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
142 When a command reads an argument with the minibuffer, your |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
143 minibuffer input becomes part of the macro along with the command. So |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
144 when you replay the macro, the command gets the same argument as |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
145 when you entered the macro. For example, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
146 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
147 @example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
148 C-x ( C-a C-@key{SPC} C-n M-w C-x b f o o @key{RET} C-y C-x b @key{RET} C-x ) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
149 @end example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
150 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
151 @noindent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
152 defines a macro that copies the current line into the buffer |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
153 @samp{foo}, then returns to the original buffer. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
154 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
155 You can use function keys in a keyboard macro, just like keyboard |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
156 keys. You can even use mouse events, but be careful about that: when |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
157 the macro replays the mouse event, it uses the original mouse position |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
158 of that event, the position that the mouse had while you were defining |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
159 the macro. The effect of this may be hard to predict. (Using the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
160 current mouse position would be even less predictable.) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
161 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
162 One thing that doesn't always work well in a keyboard macro is the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
163 command @kbd{C-M-c} (@code{exit-recursive-edit}). When this command |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
164 exits a recursive edit that started within the macro, it works as you'd |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
165 expect. But if it exits a recursive edit that started before you |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
166 invoked the keyboard macro, it also necessarily exits the keyboard macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
167 as part of the process. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
168 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
169 After you have terminated the definition of a keyboard macro, you can add |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
170 to the end of its definition by typing @kbd{C-u C-x (}. This is equivalent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
171 to plain @kbd{C-x (} followed by retyping the whole definition so far. As |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
172 a consequence it re-executes the macro as previously defined. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
173 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
174 You can also add to the end of the definition of the last keyboard |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
175 macro without re-execuing it by typing @kbd{C-u C-u C-x (}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
176 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
177 The variable @code{kmacro-execute-before-append} specifies whether |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
178 a single @kbd{C-u} prefix causes the existing macro to be re-executed |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
179 before appending to it. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
180 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
181 @findex apply-macro-to-region-lines |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
182 @kindex C-x C-k r |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
183 The command @kbd{C-x C-k r} (@code{apply-macro-to-region-lines}) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
184 repeats the last defined keyboard macro on each complete line within |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
185 the current region. It does this line by line, by moving point to the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
186 beginning of the line and then executing the macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
187 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
188 @node Keyboard Macro Ring |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
189 @section Where previous keyboard macros are saved |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
190 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
191 All defined keyboard macros are recorded in the ``keyboard macro ring'', |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
192 a list of sequences of keys. There is only one keyboard macro ring, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
193 shared by all buffers. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
194 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
195 All commands which operates on the keyboard macro ring use the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
196 same @kbd{C-x C-k} prefix. Most of these commands can be executed and |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
197 repeated immediately after each other without repeating the @kbd{C-x |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
198 C-k} prefix. For example, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
199 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
200 @example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
201 C-x C-k C-p C-p C-k C-k C-k C-n C-n C-k C-p C-k C-d |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
202 @end example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
203 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
204 @noindent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
205 will rotate the keyboard macro ring to the ``second previous'' macro, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
206 execute the resulting head macro three times, rotate back to the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
207 original head macro, execute that once, rotate to the ``previous'' |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
208 macro, execute that, and finally delete it from the macro ring. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
209 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
210 @findex kmacro-end-or-call-macro-repeat |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
211 @kindex C-x C-k C-k |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
212 The command @kbd{C-x C-k C-k} (@code{kmacro-end-or-call-macro-repeat}) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
213 executes the keyboard macro at the head of the macro ring. You can |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
214 repeat the macro immediately by typing another @kbd{C-k}, or you can |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
215 rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
216 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
217 @findex kmacro-cycle-ring-next |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
218 @kindex C-x C-k C-n |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
219 @findex kmacro-cycle-ring-previous |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
220 @kindex C-x C-k C-p |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
221 The commands @kbd{C-x C-k C-n} (@code{kmacro-cycle-ring-next}) and |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
222 @kbd{C-x C-k C-p} (@code{kmacro-cycle-ring-previous}) rotates the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
223 macro ring, bringing the next or previous keyboard macro to the head |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
224 of the macro ring. The definition of the new head macro is displayed |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
225 in the echo area. You can continue to rotate the macro ring |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
226 immediately by repeating just @kbd{C-n} and @kbd{C-p} until the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
227 desired macro is at the head of the ring. To execute the new macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
228 ring head immediately, just type @kbd{C-k}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
229 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
230 @findex kmacro-view-macro-repeat |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
231 @kindex C-x C-k C-v |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
232 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
233 The commands @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat}) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
234 displays the last keyboard macro, or when repeated (with @kbd{C-v}), |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
235 it displays the previous macro on the macro ring, just like @kbd{C-x |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
236 C-k C-p}, but without actually rotating the macro ring. If you enter |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
237 @kbd{C-k} immediately after displaying a macro from the ring, that |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
238 macro is executed, but still without altering the macro ring. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
239 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
240 So while e.g. @kbd{C-x C-k C-p C-p C-k C-k} makes the 3rd previous |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
241 macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
242 C-v C-k C-k} will display and execute the 3rd previous macro once and |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
243 then the current macro once. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
244 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
245 @findex kmacro-delete-ring-head |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
246 @kindex C-x C-k C-d |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
247 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
248 The commands @kbd{C-x C-k C-d} (@code{kmacro-delete-ring-head}) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
249 removes and deletes the macro currently at the head of the macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
250 ring. You can use this to delete a macro that didn't work as |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
251 expected, or which you don't need anymore. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
252 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
253 @findex kmacro-swap-ring |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
254 @kindex C-x C-k C-t |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
255 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
256 The commands @kbd{C-x C-k C-t} (@code{kmacro-swap-ring}) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
257 interchanges the head of the macro ring with the previous element on |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
258 the macro ring. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
259 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
260 @findex kmacro-call-ring-2nd-repeat |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
261 @kindex C-x C-k C-l |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
262 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
263 The commands @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat}) |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
264 executes the previous (rather than the head) element on the macro ring. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
265 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
266 @node Keyboard Macro Counter |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
267 @section Inserting incrementing numbers in macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
268 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
269 Each keyboard macro has an associated counter which is automatically |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
270 incremented on every repetition of the keyboard macro. Normally, the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
271 macro counter is initialized to 0 when you start defining the macro, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
272 and incremented by 1 after each insertion of the counter value; |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
273 that is, if you insert the macro counter twice while defining the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
274 macro, it will be incremented by 2 time for each repetition of the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
275 macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
276 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
277 @findex kmacro-insert-counter |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
278 @kindex C-x C-k C-i |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
279 The command @kbd{C-x C-k C-i} (@code{kmacro-insert-counter}) inserts |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
280 the current value of the keyboard macro counter and increments the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
281 counter by 1. You can use a numeric prefix argument to specify a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
282 different increment. If you specify a @kbd{C-u} prefix, the last |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
283 inserted counter value is repeated and the counter is not incremented. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
284 For example, if you enter the following sequence while defining a macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
285 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
286 @example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
287 C-x C-k C-i C-x C-k C-i C-u C-x C-k C-i C-x C-k C-i |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
288 @end example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
289 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
290 @noindent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
291 the text @samp{0112} is inserted in the buffer, and for the first and |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
292 second execution of the macro @samp{3445} and @samp{6778} are |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
293 inserted. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
294 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
295 @findex kmacro-set-counter |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
296 @kindex C-x C-k C-c |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
297 The command @kbd{C-x C-k C-c} (@code{kmacro-set-counter}) prompts |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
298 for the initial value of the keyboard macro counter if you use it |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
299 before you define a keyboard macro. If you use it while defining a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
300 keyboard macro, you set the macro counter to the same (initial) value |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
301 on each repetition of the macro. If you specify a @kbd{C-u} prefix, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
302 the counter is reset to the value it had prior to the current |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
303 repetition of the macro (undoing any increments so far in this |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
304 repetition). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
305 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
306 @findex kmacro-add-counter |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
307 @kindex C-x C-k C-a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
308 The command @kbd{C-x C-k C-a} (@code{kmacro-add-counter}) prompts |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
309 for a value to add to the macro counter. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
310 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
311 @findex kmacro-set-format |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
312 @kindex C-x C-k C-f |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
313 The command @kbd{C-x C-k C-f} (@code{kmacro-set-format}) prompts |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
314 for the format to use when inserting the macro counter. The default |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
315 format is @samp{%d}. If you set the counter format before you define a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
316 macro, that format is restored before each repetition of the macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
317 Consequently, any changes you make to the macro counter format while |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
318 defining a macro are only active for the rest of the macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
319 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
320 @node Keyboard Macro Query |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
321 @section Executing Macros with Variations |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
322 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
323 @kindex C-x q |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
324 @findex kbd-macro-query |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
325 Using @kbd{C-x q} (@code{kbd-macro-query}), you can get an effect |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
326 similar to that of @code{query-replace}, where the macro asks you each |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
327 time around whether to make a change. While defining the macro, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
328 type @kbd{C-x q} at the point where you want the query to occur. During |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
329 macro definition, the @kbd{C-x q} does nothing, but when you run the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
330 macro later, @kbd{C-x q} asks you interactively whether to continue. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
331 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
332 The valid responses when @kbd{C-x q} asks are @key{SPC} (or @kbd{y}), |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
333 @key{DEL} (or @kbd{n}), @key{RET} (or @kbd{q}), @kbd{C-l} and @kbd{C-r}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
334 The answers are the same as in @code{query-replace}, though not all of |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
335 the @code{query-replace} options are meaningful. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
336 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
337 These responses include @key{SPC} to continue, and @key{DEL} to skip |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
338 the remainder of this repetition of the macro and start right away with |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
339 the next repetition. @key{RET} means to skip the remainder of this |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
340 repetition and cancel further repetitions. @kbd{C-l} redraws the screen |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
341 and asks you again for a character to say what to do. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
342 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
343 @kbd{C-r} enters a recursive editing level, in which you can perform |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
344 editing which is not part of the macro. When you exit the recursive |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
345 edit using @kbd{C-M-c}, you are asked again how to continue with the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
346 keyboard macro. If you type a @key{SPC} at this time, the rest of the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
347 macro definition is executed. It is up to you to leave point and the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
348 text in a state such that the rest of the macro will do what you |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
349 want.@refill |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
350 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
351 @kbd{C-u C-x q}, which is @kbd{C-x q} with a numeric argument, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
352 performs a completely different function. It enters a recursive edit |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
353 reading input from the keyboard, both when you type it during the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
354 definition of the macro, and when it is executed from the macro. During |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
355 definition, the editing you do inside the recursive edit does not become |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
356 part of the macro. During macro execution, the recursive edit gives you |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
357 a chance to do some particularized editing on each repetition. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
358 @xref{Recursive Edit}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
359 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
360 Another way to vary the behavior of a keyboard macro is to use a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
361 register as a counter, incrementing it on each repetition of the macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
362 @xref{RegNumbers}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
363 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
364 @node Save Keyboard Macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
365 @section Naming and Saving Keyboard Macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
366 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
367 @cindex saving keyboard macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
368 @findex name-last-kbd-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
369 @kindex C-x C-k n |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
370 If you wish to save a keyboard macro for later use, you can give it |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
371 a name using @kbd{C-x C-k n} (@code{name-last-kbd-macro}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
372 This reads a name as an argument using the minibuffer and defines that name |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
373 to execute the macro. The macro name is a Lisp symbol, and defining it in |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
374 this way makes it a valid command name for calling with @kbd{M-x} or for |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
375 binding a key to with @code{global-set-key} (@pxref{Keymaps}). If you |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
376 specify a name that has a prior definition other than another keyboard |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
377 macro, an error message is shown and nothing is changed. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
378 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
379 @cindex binding keyboard macros |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
380 @findex kmacro-bind-to-key |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
381 @kindex C-x C-k b |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
382 Rather than giving a keyboard macro a name, you can bind it to a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
383 key using @kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
384 key sequence you want the keyboard macro to be bound to. You can |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
385 bind to any key sequence in the global keymap, but since most key |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
386 sequences already have other bindings, you should select the key |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
387 sequence carefylly. If you try to bind to a key sequence with an |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
388 existing binding (in any keymap), you will be asked if you really |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
389 want to replace the existing binding of that key. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
390 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
391 To avoid problems caused by overriding existing bindings, the key |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
392 sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A} |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
393 through @kbd{C-x C-k Z} are reserved for your own keyboard macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
394 bindings. In fact, to bind to one of these key sequences, you only |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
395 need to type the digit or letter rather than the whole key sequences. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
396 For example, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
397 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
398 @example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
399 C-x C-k b 4 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
400 @end example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
401 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
402 @noindent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
403 will bind the last keyboard macro to the key sequence @kbd{C-x C-k 4}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
404 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
405 @findex insert-kbd-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
406 Once a macro has a command name, you can save its definition in a file. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
407 Then it can be used in another editing session. First, visit the file |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
408 you want to save the definition in. Then use this command: |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
409 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
410 @example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
411 M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET} |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
412 @end example |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
413 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
414 @noindent |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
415 This inserts some Lisp code that, when executed later, will define the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
416 same macro with the same definition it has now. (You need not |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
417 understand Lisp code to do this, because @code{insert-kbd-macro} writes |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
418 the Lisp code for you.) Then save the file. You can load the file |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
419 later with @code{load-file} (@pxref{Lisp Libraries}). If the file you |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
420 save in is your init file @file{~/.emacs} (@pxref{Init File}) then the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
421 macro will be defined each time you run Emacs. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
422 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
423 If you give @code{insert-kbd-macro} a numeric argument, it makes |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
424 additional Lisp code to record the keys (if any) that you have bound to the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
425 keyboard macro, so that the macro will be reassigned the same keys when you |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
426 load the file. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
427 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
428 @node Edit Keyboard Macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
429 @section Interactively executing and editing a keyboard macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
430 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
431 @findex kmacro-edit-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
432 @kindex C-x C-k C-e |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
433 @kindex C-x C-k RET |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
434 You can edit the last keyboard macro by typing @kbd{C-x C-k C-e} or |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
435 @kbd{C-x C-k RET} (@code{kmacro-edit-macro}). This formats the macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
436 definition in a buffer and enters a specialized major mode for editing |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
437 it. Type @kbd{C-h m} once in that buffer to display details of how to |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
438 edit the macro. When you are finished editing, type @kbd{C-c C-c}. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
439 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
440 @findex edit-kbd-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
441 @kindex C-x C-k e |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
442 You can edit a named keyboard macro or a macro bound to a key by typing |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
443 @kbd{C-x C-k e} (@code{edit-kbd-macro}). Follow that with the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
444 keyboard input that you would use to invoke the macro---@kbd{C-x e} or |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
445 @kbd{M-x @var{name}} or some other key sequence. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
446 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
447 @findex kmacro-edit-lossage |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
448 @kindex C-x C-k l |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
449 You can edit the last 100 keystrokes as a macro by typing |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
450 @kbd{C-x C-k l} (@code{kmacro-edit-lossage}). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
451 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
452 @node Keyboard Macro Step-Edit |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
453 @section Interactively executing and editing a keyboard macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
454 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
455 @findex kmacro-step-edit-macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
456 @kindex C-x C-k SPC |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
457 You can interactively and stepwise replay and edit the last keyboard |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
458 macro one command at a time by typing @kbd{C-x C-k SPC} |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
459 (@code{kmacro-step-edit-macro}). Unless you quit the macro using |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
460 @kbd{q} or @kbd{C-g}, the edited macro replaces the last macro on the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
461 macro ring. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
462 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
463 This shows the last macro in the minibuffer together with the first |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
464 (or next) command to be executed, and prompts you for an action. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
465 You can enter @kbd{?} to get a command summary. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
466 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
467 The following commands are available in the step-edit mode and relate |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
468 to the first (or current) command in the keyboard macro: |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
469 |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
470 @itemize @bullet{} |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
471 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
472 @kbd{SPC} and @kbd{y} execute the current command, and advance to the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
473 next command in the keyboard macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
474 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
475 @kbd{n}, @kbd{d}, and @kbd{DEL} skip and delete the current command. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
476 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
477 @kbd{f} skips the current command in this execution of the keyboard |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
478 macro, but doesn't delete it from the macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
479 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
480 @kbd{TAB} executes the current command, as well as all similar |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
481 commands immediately following the current command; for example, TAB |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
482 may be used to insert a sequence of characters (corresponding to a |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
483 sequence of @code{self-insert-command} commands). |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
484 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
485 @kbd{c} continues execution (without further editing) until the end of |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
486 the keyboard macro. If execution terminates normally, the edited |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
487 macro replaces the original keyboard macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
488 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
489 @kbd{C-k} skips and deletes the rest of the keyboard macro, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
490 terminates step-editing, and replaces the original keyboard macro |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
491 with the edited macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
492 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
493 @kbd{q} and @kbd{C-g} cancels the step-editing of the keyboard macro; |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
494 discarding any changes made to the keyboard macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
495 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
496 @kbd{i KEY... C-j} reads and executes a series of key sequences (not |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
497 including the final @kbd{C-j}), and inserts them before the current |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
498 command in the keyboard macro, without advancing over the current |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
499 command. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
500 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
501 @kbd{I KEY...} reads one key sequence, executes it, and inserts it |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
502 before the current command in the keyboard macro, without advancing |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
503 over the current command. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
504 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
505 @kbd{r KEY... C-j} reads and executes a series of key sequences (not |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
506 including the final @kbd{C-j}), and replaces the current command in |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
507 the keyboard macro with them, advancing over the inserted key |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
508 sequences. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
509 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
510 @kbd{R KEY...} reads one key sequence, executes it, and replaces the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
511 current command in the keyboard macro with that key sequence, |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
512 advancing over the inserted key sequence. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
513 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
514 @kbd{a KEY... C-j} executes the current command, then reads and |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
515 executes a series of key sequences (not including the final |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
516 @kbd{C-j}), and inserts them after the current command in the keyboard |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
517 macro; it then advances over the current command and the inserted key |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
518 sequences. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
519 @item |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
520 @kbd{A KEY... C-j} executes the rest of the commands in the keyboard |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
521 macro, then reads and executes a series of key sequences (not |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
522 including the final @kbd{C-j}), and appends them at the end of the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
523 keyboard macro; it then terminates the step-editing and replaces the |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
524 original keyboard macro with the edited macro. |
57534ab575bd
New file describing enhanced keyboard macro functionality.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
525 @end itemize |