From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] org-capture with LISP function template Date: Mon, 19 Jul 2010 09:05:06 +0200 Message-ID: References: <20100719014552.GI5569@soloJazz.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=59721 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OakPX-0007ge-Vx for emacs-orgmode@gnu.org; Mon, 19 Jul 2010 03:05:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OakPW-000856-IF for emacs-orgmode@gnu.org; Mon, 19 Jul 2010 03:05:11 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:40914) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OakPW-00084x-AI for emacs-orgmode@gnu.org; Mon, 19 Jul 2010 03:05:10 -0400 Received: by ewy28 with SMTP id 28so1358515ewy.0 for ; Mon, 19 Jul 2010 00:05:09 -0700 (PDT) In-Reply-To: <20100719014552.GI5569@soloJazz.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Juan Pechiar Cc: emacs-orgmode@gnu.org Hi Juan, the function must be a symbol in this setup, not a string. I am rejecting this patch. Cheers. - Carsten On Jul 19, 2010, at 3:45 AM, Juan Pechiar wrote: > Hi Carsten + crowd, > > Below is a patch for org-capture when the template is given by a LISP > function. > > Problem was that the function is inside a string (not a LISP form), so > the string has to be evaluated explicitly. > > Now it's working for me. I use it to get a template formed by > URL/title and selected text from Opera browser (on Mac OSX). I=B4ll > publish this after polishing the code. > > I've also been testing exotic org-capture templates and I've found no > other errors yet. > > Best regards, > .j. > > 8<------------------------------------------------------------ > > diff --git a/lisp/org-capture.el b/lisp/org-capture.el > index 2a3a1b8..409427f 100644 > --- a/lisp/org-capture.el > +++ b/lisp/org-capture.el > @@ -440,8 +440,8 @@ bypassed." > (setq txt (org-file-contents file)) > (setq txt (format "* Template file %s not found" (nth 1 > txt))))) > ((and (listp txt) (eq (car txt) 'function)) > - (if (fboundp (nth 1 txt)) > - (setq txt (funcall (nth 1 txt))) > + (if (eval (concat "fboundp " (nth 1 txt))) > + (setq txt (eval (read (nth 1 txt)))) > (setq txt (format "* Template function %s not found" (nth 1 > txt))))) > ((not txt) (setq txt "")) > ((stringp txt)) - Carsten