So I have different customized themes. Different customized themes are written to a separate custom .el
files and get called in the main init.el
file. For example:
(setq custom-file "~/.emacs.d/myCustomSettings/customDarkLaptop.el")
will call the customDarkLaptop.el
, where all of my customized variables like font size, comment color..etc.
Suppose I want to switch to a different customized themes, I then go to init.el
and change this
(setq custom-file "~/.emacs.d/myCustomSettings/customLight.el")
which will then load the customLight.el
file.
I would like to write a script to automate this process, user just need to enter either the part after custom
to the desire theme. For example:
- enter
Dark
will automatically havecustomDark.el
Replacing text from a file can be easily be done with the sed
command, i.e.
sed -i -e s/oldtext/newtext/g <enter file name here>
However, I am not sure how to incorporate this efficiently into my init.el
file. What I want is something like this:
- create a string variable in
init.el
:themeName = "Dark"
Append it to my
set-q
command file path like this:(setq custom-file "~/.emacs.d/myCustomSettings/custom<INSERT THE VARIABLE themeName HERE>.el")
My sed
script will just replace one thing, the variable themeName
in init.el
.
How do you do this in elisp?