From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Capture Bug?
Date: Wed, 21 Sep 2016 17:38:36 -0400 [thread overview]
Message-ID: <874m590w83.fsf@gmail.com> (raw)
In-Reply-To: 87bmzhsc18.fsf@alphapapa.net
Adam Porter <adam@alphapapa.net> writes:
> lists@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)))
>>
>>
>> ("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
next prev parent reply other threads:[~2016-09-21 21:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 8:58 Capture Bug? lists
2016-09-21 11:54 ` Adam Porter
2016-09-21 18:24 ` lists
2016-09-21 20:01 ` Adam Porter
2016-09-21 20:51 ` Nicolas Goaziou
2016-09-22 9:14 ` Ian Barton
2016-09-21 21:38 ` Nick Dokos [this message]
2016-09-22 2:54 ` Adam Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874m590w83.fsf@gmail.com \
--to=ndokos@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.