14

I find .emacs, and ~/.emacs.d/init.el.

What those files/directories are for? What's the startup sequence of emacs? Is there any way that makes emacs not to read ~/.emacs.d?

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
prosseek
  • 182,215
  • 215
  • 566
  • 871

4 Answers4

16

emacs -q or emacs --no-init-file will cause emacs not to read the ~/.emacs file. It should not try to read the ~/.emacs.d if there is a ~/.emacs file. If there isn't a ~/.emacs file it will read ~/.emacs.d/init.el. See the emacs wiki for more info.

See the elisp manual for info on startup.

chwarr
  • 6,777
  • 1
  • 30
  • 57
deinst
  • 18,402
  • 3
  • 47
  • 45
4

Emacs' start-up procedure is explained in detail here. The emacs lisp manual ships with emacs, so you should consult that instead of the linked manual on the web, because the former will exactly match your emacs version. To visit it, in emacs type C-h i m elisp RET m Starting Up RET.

Tassilo Horn
  • 791
  • 8
  • 14
3

Based on sanityinc's answer, I did some experiments by adding (message "* MESSAGE *") at the end of ~/.emacs.d/init.el, my personal el file (smcho.el), and .emacs.el, and I opened Messages buffer.

This is the result from Aquamacs.

Loading prestart plugin files ...
... done.
Shell: /bin/bash
Loading `emulate-mac-keyboard-mode': old-style backquotes detected!
Loading /Users/smcho/Library/Preferences/Aquamacs Emacs/Recent Files.el (source)...done
Cleaning up the recentf list...done (0 removed)
27 environment variables imported from login shell (/bin/bash).
Loading /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/auctex.el (source)...done
Loading /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/haskell-mode/haskell-site-file.el (source)...done
Loading plugins ...
Loading /Library/Application Support/Aquamacs Emacs/SLIME/site-start.el (source)...done
Loading /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start.el (source)...done
... done.
***** Hello from .emacs, and I'm with Aquamacs 
***** hello from smcho.el 
Loading /Users/smcho/Library/Preferences/Aquamacs Emacs/customizations.el (source)...done
Loading /Users/smcho/Library/Preferences/Aquamacs Emacs/Preferences.el (source)...done
Mark set
one-buffer-one-frame-mode disabled.
Loading /Users/smcho/Library/Preferences/Aquamacs Emacs/frame-positions.el (source)...done

It reads from .emacs and smcho.el, but not from ~/.emacs.d/init.el. This is from Aqua emacs.

Loading /Users/smcho/.emacs.d/package.el (source)...done
***** Hello from .emacs, and I'm with Aqua emacs
***** hello from smcho.el
For information about GNU Emacs and the GNU system, type C-h C-a.

Again it doesn't read from ~/.emacs.d/init.el, but the starting point if ~/.emacs.d/package.el.

Community
  • 1
  • 1
prosseek
  • 182,215
  • 215
  • 566
  • 871
2

if there is a .emacs file ,then emacs won`t load the ~/.emacs.d/init.el file,if you want to use .emacs.d/init.el file ,you should remove ~/.emacs file

CharlesX
  • 418
  • 4
  • 7
  • 14