Difference between revisions of "User's Initialization File"

From WikEmacs
Jump to: navigation, search
m (Reverted edits by 91.200.13.70 (talk) to last revision by 190.222.163.30)
(how to package the config)
 
(3 intermediate revisions by 3 users not shown)
Line 15: Line 15:
  
 
Running the above command will enable the Emacs Lisp debugger for errors in the init file.
 
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"))
 +
 +
See [https://github.com/noahfrederick/dots/tree/master/emacs.d an example config with Cask and org-mode].
 +
 +
 +
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]].
  
 
== See Also ==
 
== See Also ==
  
* [[Prelude]]
+
* [[Prelude]], a much more powerful and productive set of initial configuration than the one you get out of the box.
 
* [[Emacs Starter Kit]]
 
* [[Emacs Starter Kit]]
 +
* [[package.el]], the built-in package manager in Emacs 24.
  
 
== External links ==
 
== External links ==

Latest revision as of 12:18, 12 September 2014

User's Initialization File or dotemacs or init file is a file to store your configurations/customizations for Emacs written in Emacs Lisp, located at either ${HOME}/.emacs.d/init.el or (archaically) at ${HOME}/.emacs or at %HOME%\_emacs on MS Windows.

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.

Configuration Example[edit]

For a good example of an init file check out some of the starter kits, like Prelude.

Debugging the Init file[edit]

$ 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[edit]

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"))

See an example config with Cask and org-mode.


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.

See Also[edit]

  • 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.

External links[edit]