0

I am a newbie at emacs lisp and was looking for some assistance.

I am trying to use a capture template from a file. Here is relevant code:

(setq base-capture-template (concat (file-name-as-directory capture-template-directory) "base_tpl.txt"))
(setq org-capture-templates
  (quote (("w" "work" entry (file+headline org-tasks-file "WORK") (file base-capture-template) :kill-buffer t)))

When I try the template, I get an error: Wrong type argument: stringp, base-capture-template.

Is there a way to convert the symbol base-capture-template such that it corresponds to the expected type?

Thanks.

-gyro

2
  • As you have written it, there is a missing closing paren for the second setq: either add it or use the '(...) shorthand instead of (quote (...)). Some other relevant code is missing: what is capture-template-directory? What is org-tasks-file?
    – NickD
    Nov 12, 2018 at 18:55
  • Also, I'm not sure but I don't think you can have two different target specifications for the same entry: either file+headline or file but not both.
    – NickD
    Nov 13, 2018 at 0:23

1 Answer 1

3

Welcome to SX (emacs).

Try this:

(setq org-capture-templates
  `(("w" "work" entry (file+headline org-tasks-file "WORK") 
    (file ,base-capture-template) :kill-buffer t)))

Explanation: the back-quote allows you to mostly quote but evaluate the bits that have a comma in front.

2
  • Excellent! Thank you for the help, Fran. I would upvote your response, but I don't have the reputation.
    – user86993
    Nov 13, 2018 at 13:33
  • I think you can accept the answer though! (And glad this helped.) Nov 14, 2018 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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