Emacs: Init File Tutorial

By Xah Lee. Date: . Last updated: .

What is Init File

Emacs init file is a file emacs loads when it starts up. It is used to customize emacs.

Emacs init file is also known as “dot emacs file”.

Where is Init File

Can i delete the emacs init file?

Yes. It's ok to delete your init file and start over. (if you don't have anything important you put there.)

How to find out if emacs init is loaded?

put this in your Emacs Init File:

(set-background-color "ivory")

If emacs starts with new background color, then it's loaded.

Start Emacs Without Loading Init File

Load Init File Without Restarting Emacs

Once the code is evaluated, effect are immediate.

💡 TIP: some packages, or elisp code, may behave differently when loaded twice. And some snippet of code may not work by simply running it by itself (it may assume some other code has been loaded before or after.).

If you have a problem, restart emacs.

Restart Emacs

Alt+x restart-emacs

(new in Emacs 29 (Released 2023-07))

Reference

2017-07-02 much thanks to jcs. http://irreal.org/blog/

2011-11-21 Thanks to Ivan Kozik (http://ludios.org/ivank/) for a tip.

Emacs, start, exit, and init files