Adam Porter <a...@alphapapa.net> writes:
> li...@wilkesley.net writes:
>> I have a capture template which prompts for a file name and uses this
>> to create a filename with a datestamp:
>> (defun capture-pelican-draft-file (path)
>> (let ((name (read-string "Name: ")))
>> (expand-file-name (format "%s-%s.org"
>> (format-time-string "%Y-%m-%d")
>> name) path)))
>> "New blog post (ianbarton.net)"
>> (file (capture-pelican-draft-file
>> "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED:
>> \n#+TITLE\n#+CATEGORY: Blog \n#+PROPERTY: TAGS \n#+PROPERTY: SUMMARY
>> \n#+SETUPFILE: ../setup.org\n\n")
> Are you using custom-set-variables to set org-capture-templates? If
> not, I think you need to unquote capture-pelican-draft-file.
That's not going to work: unquoting[fn:1] evaluates the unquoted
element during the setting of org-capture-templates. That would have
the effect of evaluating the function call when the setq is evaluated,
whereas the intent here is to evaluate the function call *much* later,
when the capture is initiated.
[fn:1] ... by which I hope I mean the same thing you do:
using backquote instead of quote in front of the <list> in
(setq org-capture-templates <list>)
and then using , to unquote some internal elements, allowing their
evaluation and therefore replacing them with the results of the
evaluation in the binding of org-capture-templates.