How do I find which .emacs file has been loaded?

Silfheed picture Silfheed · May 14, 2009 · Viewed 11.9k times · Source

How do I get emacs to tell me the location of the .emacs file it has loaded?

My situation is simply when I do sudo emacs, it loads up a very different .emacs file than the one in my home directory. I can get around with by doing M-x eval-buffer on my own .emacs file, but that's a lot of extra steps, plus it doesnt seem to clear out the goofy binds in whatever .emacs file is being loaded. If anything, I'd simply like to find the .emacs file and remove some of the stranger binds (c-n, c-p, c-a all rebound to strange stuff)

My main question is still, how do I get emacs to tell me the location of the .emacs file it has loaded?

Answer

Beano picture Beano · May 14, 2009

The init file used is stored in the variable 'user-init-file'. To see this use 'describe-variable' (C-h v), type in 'user-init-file' and it will display the file used.