User's Initialization File
The most reliable way to find our the place of the initialization file on your system is to check the value of the user-init-file variable.
For a good example of an init file check out some of the starter kits, like Prelude.
Debugging the Init file
$ emacs --debug-init
Running the above command will enable the Emacs Lisp debugger for errors in the init file.
How to package your config and packages
Will come a moment when you want to duplicate your emacs configuration into another computer. And you realize that you rely on a lot of third party packages that you don't want to re-install manually ! So how can we package our config, along with all our packages ? There are some options.
First you would obviously bundle everything into source control (except for a private file). Bitbucket and Gitlab offer private repos.
You then must read the page on package.el to see a way to list all the packages you use.
You can use Cask to manage all the dependencies. A Cask file lists them all, like
(depends-on "cask") (depends-on "dash") (depends-on "evil")
Some write their config in org-mode and load it with a call to org-babel, which is doable in one line in ~/.emacs.d/init.el:
(require 'org) (require 'ob-tangle) (org-babel-load-file (expand-file-name "~/.emacs.d/myemacs.org"))
some split it in multiple elisp files, some keep it in one big file.
Finally, to speed up the installation and ensure the same environment, you can also commit the pckages installed with package.el.
You can take inspiration from Starter Kits.
- Prelude, a much more powerful and productive set of initial configuration than the one you get out of the box.
- Emacs Starter Kit
- package.el, the built-in package manager in Emacs 24.