|
|
Emacs Macros
Last changed: 2005-07-24 [8:08]
Content:
Notes on defining Emacs Macros
|
Table of contents |
General notes
- When defining a macro including a search, then define the macro
for the first edit and include the search to the next item in
the macro. If this next item shout not be modified, just hit
C-s C-s to repeat the search and jump to the next item.
- Use C-\ to undo a step
- Limit action of a macro by limiting to a region with C-n n
- Rebind the macro to a single key:
(define-key global-map [f2] 'call-last-kbd-macro)
- C-x C-k C-h l -> Creates a macro of the last 100 keystrokes
Use registers to increment numbers in macros
C-u 1 C-x r n a ;; put 1 in register a
C-x ( ;; start macro
hostname ;; type hostname
C-x r i a ;; insert register a
C-e ;; end of line
C-x r + a ;; increment register a
.lm.com<RET> ;; finish typing hostname
C-x ) ;; finish keyboard macro
|