Книга: Learning GNU Emacs, 3rd Edition
2.7 Making Emacs Work the Way You Want
If you've been reading straight through this book, you may have started a list of things you'd like to change about Emacs, such as
• Hiding the toolbar
• Changing Emacs cut and paste commands to C-x, C-c, and C-v
• Turning on text mode and a fill mode so Emacs does word wrap
• Changing the way some of the keys work
We're going to tell you how to give Emacs the to-do list, a list of options to turn on each time you enter Emacs. These options are defined in an initialization file called .emacs. Initialization files run automatically. Some run when you start up your computer. Others, like .emacs, run when you start up an associated software program. So .emacs runs automatically when you start Emacs and turns on whatever options the file defines. Emacs doesn't need this file to run; its only purpose is to make Emacs work the way you want it to.
The .emacs file consists of Lisp statements. If you're not a Lisp programmer, you can think of each line as an incantation that follows a certain pattern; you need to type it exactly.
Emacs now has another way to handle customization: an interactive interface called Custom that writes Lisp for you and automatically inserts it in your .emacs file. The Custom interface is discussed in Chapter 10, but we'll show you an even faster method for common options.
When you want to add a line to your .emacs file directly, take these steps:
1. Enter Emacs (if you're not already there).
2. Type C-x C-f ~/.emacs Enter.
3. Type the line to be added exactly as shown in this book and press Enter.
4. Press C-x C-s to save the .emacs file.
5. Press C-x C-c to exit Emacs.
6. Restart Emacs to have the line take effect.
If you make a minor typing mistake (such as forgetting a single quotation mark or a parenthesis), you are likely to get an error message that says Error in init file
when you restart Emacs. Simply edit the .emacs file again, checking the line you added against the place you got it from, whether from this book or another user's .emacs file. Usually, you can find the error if you look hard enough; if not, find someone who has a .emacs file (and preferably understands Lisp) and ask for help. Make the changes, save the file, and restart Emacs.
What if you make a change that essentially keeps Emacs from being able to start? You can still exit Emacs, rename the file, edit it, then save it as .emacs and try again.
- 4.4.4 The Dispatcher
- SERVER WORKING SIZE
- About the author
- Chapter 7. The state machine
- Chapter 12. Debugging your scripts
- Appendix E. Other resources and links
- Example NAT machine in theory
- The final stage of our NAT machine
- Compiling the user-land applications
- The conntrack entries
- Untracked connections and the raw table
- Basics of the iptables command