emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Capture Bug?


From: Nick Dokos
Subject: Re: [O] Capture Bug?
Date: Wed, 21 Sep 2016 17:38:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Adam Porter <address@hidden> writes:

> address@hidden 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)))
>>
>>
>> ("g"
>>    "New blog post (ianbarton.net)"
>>    plain
>>    (file (capture-pelican-draft-file
>> "~/Documents/emacs/web_sites/ianbarton.net/org/_posts"))
>>    "#+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.


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

-- 
Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]