From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: Re: How to use org-capture with "dynamic ID" targets? Date: Tue, 29 Jan 2013 11:20:45 -0300 Message-ID: <5107dac1.e1c8ec0a.51ec.ffff8838@mx.google.com> References: <50f72bf5.669dec0a.7b79.ffffdcb0@mx.google.com> <87pq0u1k2s.fsf@bzg.ath.cx> <5106be00.0c5e650a.1535.fffff1fa@mx.google.com> <871ud4imqa.fsf@ericabrahamsen.net> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0C3R-0001An-Di for emacs-orgmode@gnu.org; Tue, 29 Jan 2013 09:20:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0C3O-0004Jz-FW for emacs-orgmode@gnu.org; Tue, 29 Jan 2013 09:20:53 -0500 Received: from mail-gh0-f170.google.com ([209.85.160.170]:40414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0C3O-0004Jl-BC for emacs-orgmode@gnu.org; Tue, 29 Jan 2013 09:20:50 -0500 Received: by mail-gh0-f170.google.com with SMTP id g14so58097ghb.1 for ; Tue, 29 Jan 2013 06:20:49 -0800 (PST) In-Reply-To: <871ud4imqa.fsf@ericabrahamsen.net> 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: Eric Abrahamsen Cc: emacs-orgmode@gnu.org It works! Thanks Eric. The backquote plus ',' did the job. I now understand why my previous attempts didn't work and I can imagine what would be necessary to implement the feature I requested (not worth it). -- Darlan At Tue, 29 Jan 2013 13:26:05 +0800, Eric Abrahamsen wrote: > > Darlan Cavalcante Moreira writes: > > > At Thu, 24 Jan 2013 20:01:47 +0100, > > Bastien wrote: > >> 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))) > > > This is something I'll have to keep in mind. However, I don't expect this > > to be a problem since I start Emacs everyday. It is enough for me if I can > > set the ID to a variable (before setting org-capture-templates) and it uses > > the variable value as the ID, instead of trying to interpret the variable > > name as the ID. In fact, even if I ever need to change the variable value > > after org-capture-templates was set I'm fine by just reevaluating (setq > > org-capture-templates ...) again so that it sees the new value. > > > > Exactly. Simple using the value of whatever list object I put there. Be it > > a variable value or a function that provides the. I'm fine if the value > > provided by a variable or a function is only read when > > org-capture-templates is set. > > > My lisp knowledge is very limited to what I have seen in my Emacs > > initialization (and a lot of trying and error). But I have never seen "@" > > used in lisp nor I know what terms to search for it.. > > All this above is pretty much exactly what you're looking for. Check out > the "Backquote" section of the elisp manual for a pretty good > introduction. If you quote using a backtick (`) rather than an > apostrophe ('), you can use the comma (,) later on to evaluate variable > values, see the example at top. I don't believe you need the @ here, but > the manual section I mentioned explains it. > > I used to do this in my agenda commands, but it wasn't really practical > because of the "only evaluate once" problem. If you restart emacs every > day, that won't really be an issue for you. > > E > >