3

I just want emacs to load another file as the configuration file, and ignore the default file ("~/.emacs").

Note that I don't want to change the original "~/.emacs" file.

I've tried to change "$HOME" env variable, but it doesn't work.

(Platform is Linux.)

4 Answers 4

8
emacs --no-init-file --load=some-other-config.el

Or with short options:

emacs -q -l some-other-config.el
Sign up to request clarification or add additional context in comments.

Comments

4

From the Emacs manual, section 48.4:

Emacs looks for your init file using the filenames ‘~/.emacs’, ‘~/.emacs.el’, or ‘~/.emacs.d/init.el’ you can choose to use any one of these three names […].

If you really want to use another file, you should consider patching Emacs and making a custom build. It looks like lisp/startup.el:1009 is a good place to start.

Comments

2

As far as I can see, the only option is to use -u to indicate another user's init file.

Comments

1

As @Benjamin quoted, there are three filenames you can choose. As normally, we choose ~/.emacs.d/init.el to be loaded. That's because, we can simply add more configuration files in this directory and add them all under version control(Git). Be sure ~/.emacs and ~/.emacs.el removed before u choose to use the ~/.emacs.d/init.el.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.