Emacs: making modular your config file.
Q. What type of configuration do we prefer? It's better a very long singol file or many small files?
A. Many small files for us and one (better if byte-compiled) very long file for emacs.
Emacs Modular Configuration lets you split your emacs configuration within of a (configurable) ~/.emacs.d/emc/config
directory. When you're ready, simply call emc-merge-config-files
and all the .el
files under that directory tree will merge on a (configurable) ~/.emacs.d/emc/emc-config.el
. Lastly, this file will be byte compiled, so all you need to write on your Emacs initalization file (e.g. ~/.emacs
or ~/.emacs.d/init.el
) is:
(load "~/.emacs.d/emc/emc-config")
Note: the directory tree ~/.emacs.d/emc/config
will be visited recursively using the BFS algorithm and in alphabetical order.
- copy
emacs-modular-configuration.el
in a directory which is in the Emacsload-path
- write on your Emacs initalization file (e.g.
~/.emacs
or~/.emacs.d/init.el
):
;; Emacs Modular Configuration entry point
(require 'emacs-modular-configuration)
(load "~/.emacs.d/emc/emc-config" t)
- write a bit of
.el
files within~/.emacs.d/emc/config
directory tree - use
emc-merge-config-files
Next time you start Emacs, you'll load the ~/.emacs.d/emc/emc-config.elc
file. That's all.
M-x customize-group
and then modular-configuration
.