From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] Capture: Expand keyword within %(SEXP) in template Date: Fri, 02 Nov 2012 12:50:02 +0100 Message-ID: <87ip9oi5qt.fsf@gmail.com> References: <1351848001-11636-1-git-send-email-ryo.takaishi.0@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUFpK-0001cd-4q for emacs-orgmode@gnu.org; Fri, 02 Nov 2012 07:54:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TUFpJ-00017Y-3d for emacs-orgmode@gnu.org; Fri, 02 Nov 2012 07:54:18 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:41823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUFpI-00017A-St for emacs-orgmode@gnu.org; Fri, 02 Nov 2012 07:54:17 -0400 Received: by mail-we0-f169.google.com with SMTP id u3so1855072wey.0 for ; Fri, 02 Nov 2012 04:54:16 -0700 (PDT) In-Reply-To: <1351848001-11636-1-git-send-email-ryo.takaishi.0@gmail.com> (Ryo TAKAISHI's message of "Fri, 2 Nov 2012 18:20:01 +0900") 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: Ryo TAKAISHI Cc: emacs-orgmode@gnu.org 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? > + (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, -- Nicolas Goaziou