I am using Chemacs2 and I want to set an environment variable in the .emacs-profiles.el, eg
To clarify the problem .emacs-profiles.el is not executed it is read and I have updated the post with a proper sample, ie a list of lists.
It does not provide and is not required
(
("vanilla" .((user-emacs-directory . "~/emacsen/vanilla/.emacs.d")))
("doom01" . ((user-emacs-directory . "~/emacsen/doom01/.emacs.d")
(env . (("DOOMDIR" . "~/emacsen/doom01/doomdir")
("PATH" . (concat "~/emacsen/doom01/.emacs.d/bin/doom" ":" (getenv "PATH")))
))))
)
The file that processes it is https://github.com/plexus/chemacs2/blob/master/chemacs.el.
The profile eg vanilla or doom01 is passed on the command line and its values such as user-emacs-directory and env used for that Emacs session.
The function which sets the environment variables is
(mapcar (lambda (env)
(setenv (car env) (cdr env)))
(chemacs-profile-get 'env))
and it fails on the pair ("PATH" . (concat "~/emacsen/doom01/.emacs.d/bin/doom" ":" (getenv "PATH"))) because (cdr env) which is (concat "~/emacsen/doom01/.emacs.d/bin/doom" ":" (getenv "PATH")) gets passed to the setenv call as it is without being evaluated first.
I have tried some of the splicing techniques listed at Backquote to no avail.
If the expression in the .emacs-profiles.el can't be written in a better way then is there a way to rewrite (cdr env) in (setenv (car env) (cdr env)) in such a way that it gets evaluated to a string before setenv tries to apply it?