I'm writing an emacs wrapper to a set of scripts that require a lot of config settings to run.
These can be variously environment variables, command line parameters and so forth. They should be user visible and tweakable. They will store things like a bunch of directory locations for data files and config switches to be passed into the underlying tool.
If these were fairly static options I'd make each option customizable and create a specific group to hold them, just like other emacs config.
The difference I have is that I may want to have several different configurations that I switch between regularly - perhaps several times a day.
It doesn't feel like making these customizable options is perhaps the right way to store them. To me customizable variables have a single copy stored and change infrequently (in my custom.el
file)?
I could instead store all these values in a non-emacs solution such as an ini or yaml file and load the yaml as part of wrapper prior to executing the script.
But I was wondering if there is a more emacs-standard way of maintaining multiple custom configs that can easily be switched between?
The only thing I can think of is to use defvar
with a *
in the doc-string to make variables change-able using set-variable
. This doesn't presume they are set in a specific place like the normal use of customize. However this is perhaps now deprecated in favour of customize?
I guess in this case each config file would be an e-lisp file setting each of these options. This doesn't feel much different from having the options as standard lisp global variables however.
Any advice or ideas how to achieve this? Perhaps custom
is the right tool and I have misunderstood its purpose or there is something else?