Emacs configurations: basics
In this series of posts a step by step introduction of configuring Emacs to a proper working environment will be covered. The Emacs configuration files will be pasted and explained.
When Emacs is started, it reads the initialization file .emacs
from some
default directories. One of those is the HOME directory of the current user.
Under Linux, it is the directory ~
. Under Windows it is typically under what
the HOME environment has specified, or check here for a detailed
description (Section 3.5).
Essentially you can put everything in this .emacs
file, but here in this post
a more structured way is introduce for easy management of configurations for
different uses of Emacs. The .emacs
file simply looks like the following.
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(mapc 'load (directory-files "~/.emacs.d" t "\.el\'"))
The first line specifies where Emacs should find configuration files or packages
in addition to its defaults. The Emacs LISP jargon ‘mapc’ function loads every
.el
file in the .emacs.d
directory under the HOME directory one by one, so
you can put your different configuration files separate. When you want to
disable anyone of them, just change their extension from .el
to .el.bak
then
you are fine. Using the Emacs dired
mode or the Emacs shell, this is can be
done quite easily.