The context
I always experiment with commands in the following path $HOME/trash/experimental
. For this reason, I wanted to make all shell
code blocks to use that directory as the default directory. I've already accomplished that by setting the following in my configuration
$ cat ~/.emacs.d/init.el
(org-babel-do-load-languages
'org-babel-load-languages '((shell . t)))
(setq org-babel-default-header-args:shell '((:dir . "~/trash/experimental")))
Sometimes I also play with the zsh
and the dash
shell so I would also make the previous mentioned directory as the default one for code blocks whose language is any of those shells. Similarly, I can accomplish that by setting the following in my init.el
file.
$ cat ~/.emacs.d/init.el
(org-babel-do-load-languages
'org-babel-load-languages '((shell . t)))
(setq org-babel-default-header-args:shell '((:dir . "~/trash/experimental")))
(setq org-babel-default-header-args:dash '((:dir . "~/trash/experimental")))
(setq org-babel-default-header-args:zsh '((:dir . "~/trash/experimental")))
As seen above, the path is repeated three times. In order to avoid that I defined a variable that stores the path where I experiment with commands (i.e. ~/trash/experimental
). Thus, my configration file looks like
$ cat ~/.emacs.d/init.el
(org-babel-do-load-languages
'org-babel-load-languages '((shell . t)))
(setf path/experiments "~/trash/experimental")
(setq org-babel-default-header-args:shell '((:dir . path/experiments)))
(setq org-babel-default-header-args:dash '((:dir . path/experiments)))
(setq org-babel-default-header-args:zsh '((:dir . path/experiments)))
This is where the problem comes.
The problem
When evaluating code blocks whose language is shell
, dash
or zsh
, I get the following error
Wrong type argument: stringp, path/experiments
The question
How can I use the value of a variable so that it affects all code blocks whose language is zsh
, dash
or shell
?