From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Capture Bug? Date: Wed, 21 Sep 2016 17:38:36 -0400 Message-ID: <874m590w83.fsf@gmail.com> References: <660bdacc1d49d4c46a36cc4edf42db66@wilkesley.net> <87bmzhsc18.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmpEX-0000U5-8N for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 17:39:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmpET-0007E9-AY for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 17:39:13 -0400 Received: from [195.159.176.226] (port=53988 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmpET-0007CI-3W for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 17:39:09 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bmpEE-0002h0-D7 for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 23:38:54 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Adam Porter 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 in (setq org-capture-templates ) 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