Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to set a customizable variable when I start Emacs? E.g. I have a project name variable, which I usually set interactively using M-x customize-variable, but I'd like to set it already when starting Emacs. I.e. so I can choose a project from the command line.

share|improve this question
up vote 7 down vote accepted

You can run

emacs --eval '(setq variable-name value)'

to do this. Or you could edit your settings file in such a way that it reads the customization from some environment variable, and set that on the command line.

share|improve this answer
+1 for the environment variable! Can you give a complete example please? – Dror Sep 18 '13 at 18:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.