1.6 Emacs Commands
1.6 Emacs Commands
You're about to start learning some Emacs commands, so let's discuss them a bit first. How do you give commands? Each command has a formal name, which (if you're fastidious) is the name of a Lisp routine. Some command names are quite long; you usually wouldn't want to type the whole thing. As a result, we need some way to abbreviate commands.
Emacs ties a command name to a short sequence of keystrokes. This tying of commands to keystrokes is known as binding. Even things you don't normally think about as commands, such as inserting the characters that you type, are handled through the binding mechanism. Keys like "A" are bound to the Emacs command self-insert-command, which inserts them into the buffer you are editing. Most actions that you would normally think of as editor commands are bound to keystroke sequences starting with Ctrl or Meta. Emacs also binds some commands to mouse clicks (alone or modified by Shift or Ctrl) and to options on menus.
The authors of Emacs try to bind the most frequently used commands to the key sequences that are the easiest to reach. Here are the varieties of key sequences you'll encounter:
• The most commonly used commands (such as cursor movement commands) are bound to C-n (where n is any character). To press C-n, press and hold the Ctrl key and press n, then release both keys.
• Slightly less commonly used commands are bound to M-n. To press M-n, press and hold the Meta key (usually next to the space bar), then press n.
• Other commonly used commands are bound to C-x something (C-x followed by something else—one or more characters or another control sequence). Among other types of commands, file manipulation commands, like the ones you are about to learn, are generally bound to C-x something.
• Some specialized commands are bound to C-c something. These commands often relate to one of the more specialized modes, such as Java mode or HTML mode. You won't encounter them until later in this book.
• This list still doesn't take care of all the possibilities. You can get at the remaining commands by typing M-x long-command-nameEnter. (This works for any command really, but the keystrokes are usually easier to learn.)
You can define your own key bindings, too, and you should do so if you find yourself using the long form of a command all the time. More on this topic in Chapter 10.
You can also access common commands through menus, but for maximum productivity, we recommend you learn the keystrokes, often given in parentheses following the menu option.
- Working with emacs
- Chapter 5. Emacs as a Work Environment
- 2.1.5 Emacs Commands and Your Keyboard
- 11.1.3 Turning Lisp Functions into Emacs Commands
- 14.3 Help with Complex Emacs Commands
- Appendix A. Detailed explanations of special commands
- 10.2 Modifying the .emacs File Directly
- Use Essential Commands from the
- Using Basic Print Commands
- Using Commands in the ftpaccess File to Configure wu-ftpd
- Configure Commands Directed Toward the cdpath