From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryo TAKAISHI Subject: Re: [PATCH] Capture: Expand keyword within %(SEXP) in template Date: Fri, 02 Nov 2012 22:55:56 +0900 Message-ID: <878vak9kib.fsf@gmail.com> References: <1351848001-11636-1-git-send-email-ryo.takaishi.0@gmail.com> <87ip9oi5qt.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUHjF-0005qy-EX for emacs-orgmode@gnu.org; Fri, 02 Nov 2012 09:56:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TUHj9-0006r6-Is for emacs-orgmode@gnu.org; Fri, 02 Nov 2012 09:56:09 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:42564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUHj9-0006qz-C9 for emacs-orgmode@gnu.org; Fri, 02 Nov 2012 09:56:03 -0400 Received: by mail-pb0-f41.google.com with SMTP id rq2so2659916pbb.0 for ; Fri, 02 Nov 2012 06:56:02 -0700 (PDT) In-Reply-To: <87ip9oi5qt.fsf@gmail.com> (Nicolas Goaziou's message of "Fri, 02 Nov 2012 12:50:02 +0100") 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org Nicolas Goaziou writes: > Hello, > > Thanks for your patch. Here are a few comments about it. > > Ryo TAKAISHI writes: > >> * lisp/org-capture.el: If %(SEXP) has %:keyword, expand it using org-store-link-plist. >> >> I want to expand %:description keyword in sexp "%(func %:description)". >> But if org-capture template is "%(function %:keyword)", function >> take a symbol %:keyword, it does'nt expand. >> This patch expand %:keyword within %(SEXP), so funcsion is taken %:keyword's value. >> For example, when capture template is "%(func %:description)" and >> a keyword :description is "foobar", func is taken string "foobar". > > I'm not sure to understand why this patch is necessary. Can't you use > (plist-get org-store-link-plist :description) from your sexp instead? > I did'nt come up with to use it. But "%(func %:description)" or "%(func (plist-get org-store-link-plist :description))", I think the former is readble template than the latter. >> + (let* ((sexp (mapcar '(lambda (attr) > > lambdas are self-quoting: do not explicitly quote them. > >> + (key (if (string-match "%\\(:.*\\)" attr-symbol) >> + (intern (match-string 1 attr-symbol)) >> + nil))) > > (key (and (string-match "%\\(:.*\\)" attr-symbol) > (intern (match-string 1 attr-symbol)))) > > is better. > > > Regards, Thank you for your comment, I'll refine my code. Regards, Ryo