From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: How to use org-capture with "dynamic ID" targets? Date: Thu, 24 Jan 2013 20:01:47 +0100 Message-ID: <87pq0u1k2s.fsf@bzg.ath.cx> References: <50f72bf5.669dec0a.7b79.ffffdcb0@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyS3f-0007b5-JX for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 14:01:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyS3Z-0002c3-78 for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 14:01:55 -0500 Received: from we-in-x0229.1e100.net ([2a00:1450:400c:c03::229]:49985 helo=mail-we0-x229.google.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyS3Z-0002bn-21 for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 14:01:49 -0500 Received: by mail-we0-f169.google.com with SMTP id t11so2991550wey.14 for ; Thu, 24 Jan 2013 11:01:48 -0800 (PST) In-Reply-To: <50f72bf5.669dec0a.7b79.ffffdcb0@mx.google.com> (Darlan Cavalcante Moreira's message of "Wed, 16 Jan 2013 19:38:42 -0300") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Darlan Cavalcante Moreira Cc: emacs-orgmode@gnu.org Hi Darlan, Darlan Cavalcante Moreira writes: > everything works as expected and a table in the headline with ID > "someIDstring" is used. However, if I try > > ("f" "The template description" table-line > (id some_variable) > "this is the template content" > :table-line-pos "II-1" > :immediate-finish t) Can you provide the full (setq org-capture-templates ...) s-expression? Did you tried this? (setq org-capture-templates `(("f" "The template description" table-line (id ,some_variable) "this is the template content" :table-line-pos "II-1" :immediate-finish t))) > then it does not work even if some_variable or (some_function) provides the > correct ID value. It seems that > (id something) > will always interpret "something" as a string (no matter if I put it inside > quotes or not). Yes, it expects a string. > Is it possible to achieve what I want with the current org-capture > implementation? See above. The problem being, of course, that the capture template for "f" will use some_variable *statically* -- if the value of the some_variable variable changed after you evaluated the s-expression (setq org-capture-templates ...) then the new value will not be known. > If not, consider this as a feature request. What feature exactly? To allow a function here that would dynamically set the id? > The reason behind this is that each month I want a different target table > for this capture template and I already implemented a function that returns > the correct ID. If I can somehow make the ID target type use the return > value of this function then this capture template will use the correct > table each month. If not, I would be forced to manually change the capture > template in the beginning of each month (something I will definitely > forget). If you want to use a function ,some_variable will not work, check ,@ constructs in the Elisp manual. Thanks, -- Bastien