2

I am trying to use concat from within an org-capture template. But I keep getting an "Invalid template" error, so something's not right. Here is my code:

(setq org-capture-templates
    '(("j" "Journal" entry (file+datetree "~/org/journal.org")
      (concat "* " (format-time-string "%H:%M") " %^{Title}\n\n%?"))))

Any ideas?

4

Okay, figured it out! Because the template was quoted '(("j"... the concat expression was not being evaluated. What I needed to do was use backquote and then insert a , before the concat statement to allow this part to evaluate:

(setq org-capture-templates
    `(("j" "Journal" entry (file+datetree "~/org/journal.org")
      ,(concat "* " (format-time-string "%H:%M") " %^{Title}\n\n%?"))))

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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