There are those who appreciate Emacs’s default configuration. After all, Emacs starts you in C mode when you edit a C file, starts you in Fortran mode when you edit a Fortran file, and starts you in Fundamental mode when you edit an unadorned file. This all makes sense, if you do not know who is going to use Emacs. Who knows what a person hopes to do with an unadorned file? Fundamental mode is the right default for such a file, just as C mode is the right default for editing C code. (Enough programming languages have syntaxes that enable them to share or nearly share features, so C mode is now provided by CC mode, the ‘C Collection’.)
But when you do know who is going to use Emacs—you, yourself—then it makes sense to customize Emacs.
For example, I seldom want Fundamental mode when I edit an otherwise undistinguished file; I want Text mode. This is why I customize Emacs: so it suits me.
You can customize and extend Emacs by writing or adapting a ~/.emacs file. This is your personal initialization file; its contents, written in Emacs Lisp, tell Emacs what to do.14
A ~/.emacs file contains Emacs Lisp code. You can write this
code yourself; or you can use Emacs’s
customize feature to write
the code for you. You can combine your own expressions and
auto-written Customize expressions in your .emacs file.
(I myself prefer to write my own expressions, except for those,
particularly fonts, that I find easier to manipulate using the
customize command. I combine the two methods.)
Most of this chapter is about writing expressions yourself. It describes a simple .emacs file; for more information, see The Init File in The GNU Emacs Manual, and The Init File in The GNU Emacs Lisp Reference Manual.
You may also add .el to ~/.emacs and call it a ~/.emacs.el file. In the past, you were forbidden to type the extra keystrokes that the name ~/.emacs.el requires, but now you may. The new format is consistent with the Emacs Lisp file naming conventions; the old format saves typing.