Mercurial > emacs
comparison man/kmacro.texi @ 74197:a6d2e4685692
(Basic Keyboard Macro): Mention F3/F4 more.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sun, 26 Nov 2006 12:13:30 +0000 |
parents | c7e4f78b81a6 |
children | 3d45362f1d38 c71725faff1a |
comparison
equal
deleted
inserted
replaced
74196:a6e8b67fb18f | 74197:a6d2e4685692 |
---|---|
44 | 44 |
45 @node Basic Keyboard Macro | 45 @node Basic Keyboard Macro |
46 @section Basic Use | 46 @section Basic Use |
47 | 47 |
48 @table @kbd | 48 @table @kbd |
49 @item C-x ( | 49 @item @key{F3} |
50 @itemx @key{F3} | 50 @itemx C-x ( |
51 Start defining a keyboard macro (@code{kmacro-start-macro}). | 51 Start defining a keyboard macro (@code{kmacro-start-macro}). |
52 @item @key{F4} | |
53 If a keyboard macro is being defined, end the definition; otherwise, | |
54 execute the most recent keyboard macro | |
55 (@code{kmacro-end-or-call-macro}). | |
52 @item C-x ) | 56 @item C-x ) |
53 End the definition of a keyboard macro (@code{kmacro-end-macro}). | 57 End the definition of a keyboard macro (@code{kmacro-end-macro}). |
54 @item C-x e | 58 @item C-x e |
55 Execute the most recent keyboard macro (@code{kmacro-end-and-call-macro}). | 59 Execute the most recent keyboard macro (@code{kmacro-end-and-call-macro}). |
56 First end the definition of the keyboard macro, if currently defining it. | 60 First end the definition of the keyboard macro, if currently defining it. |
57 To immediately execute the keyboard macro again, just repeat the @kbd{e}. | 61 To immediately execute the keyboard macro again, just repeat the @kbd{e}. |
58 @item @key{F4} | |
59 If a keyboard macro is being defined, end the definition; otherwise, | |
60 execute the most recent keyboard macro | |
61 (@code{kmacro-end-or-call-macro}). | |
62 @item C-u C-x ( | 62 @item C-u C-x ( |
63 Re-execute last keyboard macro, then add more keys to its definition. | 63 Re-execute last keyboard macro, then add more keys to its definition. |
64 @item C-u C-u C-x ( | 64 @item C-u C-u C-x ( |
65 Add more keys to the last keyboard macro without re-executing it. | 65 Add more keys to the last keyboard macro without re-executing it. |
66 @item C-x C-k r | 66 @item C-x C-k r |
67 Run the last keyboard macro on each line that begins in the region | 67 Run the last keyboard macro on each line that begins in the region |
68 (@code{apply-macro-to-region-lines}). | 68 (@code{apply-macro-to-region-lines}). |
69 @end table | 69 @end table |
70 | 70 |
71 @kindex F3 | |
72 @kindex F4 | |
71 @kindex C-x ( | 73 @kindex C-x ( |
72 @kindex C-x ) | 74 @kindex C-x ) |
73 @kindex C-x e | 75 @kindex C-x e |
74 @findex kmacro-start-macro | 76 @findex kmacro-start-macro |
75 @findex kmacro-end-macro | 77 @findex kmacro-end-macro |
76 @findex kmacro-end-and-call-macro | 78 @findex kmacro-end-and-call-macro |
77 To start defining a keyboard macro, type the @kbd{C-x (} command | 79 To start defining a keyboard macro, type the @kbd{F3} or @kbd{C-x (} command |
78 (@code{kmacro-start-macro}). From then on, your keys continue to be | 80 (@code{kmacro-start-macro}). From then on, your keys continue to be |
79 executed, but also become part of the definition of the macro. @samp{Def} | 81 executed, but also become part of the definition of the macro. @samp{Def} |
80 appears in the mode line to remind you of what is going on. When you are | 82 appears in the mode line to remind you of what is going on. When you are |
81 finished, the @kbd{C-x )} command (@code{kmacro-end-macro}) terminates the | 83 finished, the @kbd{F4} or @kbd{C-x )} command (@code{kmacro-end-macro}) terminates the |
82 definition (without becoming part of it!). For example, | 84 definition (without becoming part of it!). For example, |
83 | 85 |
84 @example | 86 @example |
85 C-x ( M-f foo C-x ) | 87 C-x ( M-f foo C-x ) |
86 @end example | 88 @end example |
113 indefinitely (until it gets an error or you type @kbd{C-g} or, on | 115 indefinitely (until it gets an error or you type @kbd{C-g} or, on |
114 MS-DOS, @kbd{C-@key{BREAK}}). | 116 MS-DOS, @kbd{C-@key{BREAK}}). |
115 | 117 |
116 The key @key{F4} is like a combination of @kbd{C-x )} and @kbd{C-x | 118 The key @key{F4} is like a combination of @kbd{C-x )} and @kbd{C-x |
117 e}. If you're defining a macro, @key{F4} ends the definition. | 119 e}. If you're defining a macro, @key{F4} ends the definition. |
118 Otherwise it executes the last macro. | 120 Otherwise it executes the last macro. For example, |
121 | |
122 @example | |
123 F3 xyz F4 F4 F4 | |
124 @end example | |
125 | |
126 @noindent | |
127 inserts @samp{xyzxyzxyz} in the current buffer. | |
119 | 128 |
120 If you wish to repeat an operation at regularly spaced places in the | 129 If you wish to repeat an operation at regularly spaced places in the |
121 text, define a macro and include as part of the macro the commands to move | 130 text, define a macro and include as part of the macro the commands to move |
122 to the next place you want to use it. For example, if you want to change | 131 to the next place you want to use it. For example, if you want to change |
123 each line, you should position point at the start of a line, and define a | 132 each line, you should position point at the start of a line, and define a |
150 you'd expect. But if it exits a recursive edit that started before | 159 you'd expect. But if it exits a recursive edit that started before |
151 you invoked the keyboard macro, it also necessarily exits the keyboard | 160 you invoked the keyboard macro, it also necessarily exits the keyboard |
152 macro as part of the process. | 161 macro as part of the process. |
153 | 162 |
154 After you have terminated the definition of a keyboard macro, you can add | 163 After you have terminated the definition of a keyboard macro, you can add |
155 to the end of its definition by typing @kbd{C-u C-x (}. This is equivalent | 164 to the end of its definition by typing @kbd{C-u F3} or @kbd{C-u C-x (}. |
165 This is equivalent | |
156 to plain @kbd{C-x (} followed by retyping the whole definition so far. As | 166 to plain @kbd{C-x (} followed by retyping the whole definition so far. As |
157 a consequence it re-executes the macro as previously defined. | 167 a consequence it re-executes the macro as previously defined. |
158 | 168 |
159 You can also add to the end of the definition of the last keyboard | 169 You can also add to the end of the definition of the last keyboard |
160 macro without re-executing it by typing @kbd{C-u C-u C-x (}. | 170 macro without re-executing it by typing @kbd{C-u C-u C-x (}. |