![]() |
James Thornton |
| Internet Business Consultant |
| Home | Blog | Bio | Projects | Contact | Latest Blog (new site): How to Get to Genius |
|---|
AD.3.1 Basic Use
To start defining a keyboard macro, type the C-x ( command
(
defines a macro to move forward a word and then insert `foo'.
The macro thus defined can be invoked again with the C-x e
command ( If you wish to repeat an operation at regularly spaced places in the text, define a macro and include as part of the macro the commands to move to the next place you want to use it. For example, if you want to change each line, you should position point at the start of a line, and define a macro to change that line and leave point at the start of the next line. Then repeating the macro will operate on successive lines. When a command reads an argument with the minibuffer, your minibuffer input becomes part of the macro along with the command. So when you replay the macro, the command gets the same argument as when you entered the macro. For example,
defines a macro that copies the current line into the buffer `foo', then returns to the original buffer. You can use function keys in a keyboard macro, just like keyboard keys. You can even use mouse events, but be careful about that: when the macro replays the mouse event, it uses the original mouse position of that event, the position that the mouse had while you were defining the macro. The effect of this may be hard to predict. (Using the current mouse position would be even less predictable.)
One thing that doesn't always work well in a keyboard macro is the
command C-M-c ( After you have terminated the definition of a keyboard macro, you can add to the end of its definition by typing C-u C-x (. This is equivalent to plain C-x ( followed by retyping the whole definition so far. As a consequence it re-executes the macro as previously defined.
You can edit a keyboard macro already defined by typing C-x C-k
( The command M-x apply-macro-to-region-lines repeats the last defined keyboard macro on each complete line within the current region. It does this line by line, by moving point to the beginning of the line and then executing the macro.
This document was generated on April 2, 2002 using texi2html |
|
James Thornton, jamesthornton.com>Services: Small Business Internet Marketing |
Electric Speed: Dallas Internet Marketing |