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.
Asked
Active
Viewed 114 times
5
2 Answers
8
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.
MvG
- 1,479
- 2
- 14
- 26
-
+1 for the environment variable! Can you give a complete example please? – Dror Sep 18 '13 at 18:50
-
@Dror You can use the `getenv` function to read an environment variable. – Resigned June 2023 Jan 21 '17 at 16:39
0
This does not answer the question as asked, but "automatically set a project name variable" sounds quite a lot like a job for Projectile.
Resigned June 2023
- 741
- 7
- 11