Skip to Content
Learning GNU Emacs, 3rd Edition
book

Learning GNU Emacs, 3rd Edition

by Debra Cameron, James Elliott, Marc Loy, Eric S. Raymond, Bill Rosenblatt
December 2004
Beginner to intermediate
536 pages
19h 28m
English
O'Reilly Media, Inc.
Content preview from Learning GNU Emacs, 3rd Edition

Beyond Macros

Macros are an important tool for streamlining repetitive editing. They let you write your own commands for performing complex tasks without needing to know anything more than you already know: the basic Emacs commands for moving around and manipulating text. Even if you're an Emacs novice, you should be able to use macros with little difficulty.

However, Emacs is almost infinitely flexible, and macros cannot do everything. In many situations, there's no substitute for writing a Lisp function that does exactly what you want. If you know Lisp or would like to learn some, you can write your own Lisp functions to do more complex tasks than keyboard macros can handle. Chapter 11 covers the basics of writing Lisp functions.

Table 6-6 summarizes macro commands.

Table 6-6. Macro commands

Keystrokes

Command name

Action

C-x (

kmacro-start-macro

Start macro definition.

F3

kmacro-start-macro-or-insert-counter

Start macro definition. If pressed while defining a macro, insert a counter.

C-x )

kmacro-end-macro

End macro definition.

F4

kmacro-end-or-call-macro

End macro definition (if definition is in progress) or invoke last keyboard macro.

C-x e

kmacro-end-and-call-macro

Execute last keyboard macro defined. Can type e to repeat macro.

C-x C-k n

name-last-kbd-macro

Name the last macro you created (before saving it).

(none)

insert-kbd-macro

Insert the macro you named into a file.

(none)

macroname

Execute a named keyboard macro. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning GNU Emacs, Second Edition

Learning GNU Emacs, Second Edition

Debra Cameron, Bill Rosenblatt, Eric S. Raymond
Learning the vi and Vim Editors, 7th Edition

Learning the vi and Vim Editors, 7th Edition

Arnold Robbins, Elbert Hannah, Linda Lamb
Mastering Vim

Mastering Vim

Ruslan Osipov

Publisher Resources

ISBN: 0596006489Supplemental ContentErrata Page