Entry
What does the .emacs file do?
Feb 14th, 2001 05:39
Per M Knutsen, Shai Shen-Orr
The .emacs file is an initialization file. In it, you can list all of
the things you'd like to have Emacs do as it loads. The .emacs file is
run every time you start Emacs (though Emacs can work perfectly fine
without it). The .emacs file turns on whatever options the file
defines.
For example, to make text mode the default major mode and start auto-
fill mode automatically each time you enter Emacs, type these lines in
your .emacs file:
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
The first line tells Emacs to make text mode the default major mode.
The second line turns on auto-fill mode whenever you are in text mode.
Another major use of the .emacs file is to redefine things that
irritate you. One common annoying mistake, is to click on C-x C-u for
undo (instead of C-x u). To make C-x C-u do nothing, instead of
displaying irritating messages, put this line in your .emacs file:
(global-unset-key "\C-x\C-u")
To test these, put them in your Emacs file, quit Emacs, and restart.