Adam Porter <> writes:

> 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 ""
>>                               (format-time-string "%Y-%m-%d")
>>                               name) path)))
>> ("g"
>>    "New blog post ("
>>    plain
>>    (file (capture-pelican-draft-file
>> "~/Documents/emacs/web_sites/"))
>>    "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED:
>> \n#+SETUPFILE: ../\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.

* Footnotes

[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.


Reply via email to