Now, I've checked many questions here to get an answer for what I want, but every question seems a bit different that that what I need. I use org-babel to create an init file. I often change my config and want to use it on multiple machines. Most path in the .org are relative to the home so no problem there, but some are not and some can't even deal with relative path since they are used in a shell script. So I want to define path-replacement variables at the the beginning.
Example: System 1:
(setq org-download-screenshot-file "Z:/Temp/screenshot.png")
(setq org-ditaa-jar-path "Z:/Tools/Ditaa/ditaa0_9.jar")
System 2:
(setq org-download-screenshot-file "C:/Temp/screenshot.png")
(setq org-ditaa-jar-path "C:/!Portable/Ditaa/ditaa0_9.jar")
What I need is something like:
(setq my-relative-path-one "Z:/Temp")
(setq my-relative-path-two "Z:/Tools/Ditaa")
So I can use the configuration below for both systems, just replacing the value of my-relative-path-xxx would be needed. I would then place the path matching variables in a different org file which is loaded before the main org configuration file. This would allow me to sync the main configuration file without paying attention to the path values.
(setq org-download-screenshot-file "my-relative-path-one/screenshot.png")
(setq org-ditaa-jar-path "my-relative-path-two/ditaa0_9.jar"
Thanks for any suggestion. With kind regards, Jens Lange
(setenv "RELATIVE_PATH_ONE" "z:/Temp")
followed by(setq org-download-screenshot (substitute-in-file-name "${RELATIVE_PATH_ONE}/screenshot.png"))
if you want this variable also to be accessible to shell / other programs run from Emacs.PATH
.