auf.kante
Gunnar macht sich selbststaendig und fliegt auf
die Schnauze
wird erfolgreich. Wer mag darf zuschauen.
Gunnar is starting his business. He will certainly
fail succeed. You may watch.
auf.kante
Website sections
Home
Emacs Macros
Last changed: 2005-07-24 [8:08]
Content:

Notes on defining Emacs Macros
 
Back to Personal Wiki
Table of contents
General notes

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
Back to Personal Wiki
Creative Commons-Lizenzvertrag
The content of this site is licensed under a Creative Commons 2.5 License [attribution, share-alike]