Macros are really useful for programming, but since adopting Eclipse I haven’t been using them as much, much to the detriment of my fingers.
For a while I used Notepad++ for macros. Macros are easy to use with Notepad++, but unfortunately you’re limited to trivially simple macros- for example, you can’t “search” your way through a file changing every double-quote to a single-quote. In Emacs, you can do whatever you do in emacs as a macro.
“C-x (” is analogous to the record selection in Notepad++. It means your next commands will be recorded as a macro.
When you’re done, “C-x )” tells emacs to stop recording.
“C-x e” runs the macro you’ve just recorded.
Once you create a macro, you’ll probably want to run it more than once… “C-u some-number your-command” will execute “your-command” exactly “some-number” times. This can be used to run the command “call-last-kbd-macro”. So, for example “C-u 1000 C-x e” will run the macro you just created 1000 times (or until the end of the file, whichever comes first).
Post a Comment