I have code for defining org capture like:

(setq org-capture-templates '(((
         "t"               ; key
         "Todo"            ; description
         entry             ; type
         (file+headline "C:/Users/myname/Dropbox/Privat/org/abc.org" "todo"); target
         "* TODO [#B] %^{Todo} \n From: %a\n\n%?"  ; template
         :prepend t        ; properties

This code sends the generated TODO item into the org file abc.org, located at C:/Users/myname/Dropbox/Privat/org/, the target. If I want to change the location of the target to e.g. C:/Users/myname/org/, I could either do this by changing the path description inside the capture code, or better, define a path variable outside capture, telling where org file is located, and using this inside the target description like:

(file+headline "myPathVariable/abc.org" "todo"); target

where myPathVariable = "C:/Users/myname/org".

How do I define such a path variable?

Thanks for all help : )


Are you already familar with the built-in org-directory variable? This is the default directory for org files, and will be used as the base directory for capture templates that specify a relative path.

You could just use (file+headline "abc.org" "todo") and set org-directory as appropriate.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.