From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: Add the capture feature "%(sexp)" to org-feed Date: Thu, 9 Aug 2012 20:00:37 +0200 Message-ID: References: <7822.1339898820@alphaville> <87y5lqe21l.fsf@gnu.org> <87liho86cp.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzX2L-00032K-4g for emacs-orgmode@gnu.org; Thu, 09 Aug 2012 14:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzX2E-0000Pp-NQ for emacs-orgmode@gnu.org; Thu, 09 Aug 2012 14:00:45 -0400 In-Reply-To: <87liho86cp.fsf@gnu.org> 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: Bastien Cc: Org Mode Hi Bastien On Thu, Aug 9, 2012 at 4:53 PM, Bastien wrote: > I've check against current Emacs trunk, and only three files/packages > uses this: rst.el, filesets.el and mh-e. > > So I'd rather not pollute the hundred files of Org with this. That's all right. > (org-at-regexp-p org-capture-template-embedded-elisp-re) already > returns the correct value for %(length ")") For the above example yes, but not with more than one %(): =93- %(capitalize "simple percent-escape")\n- %(capitalize "one more")=94 Also non-greedy regexp is not enough here: =93%(capitalize "(some) text")=94 > -- but you're right there > is a problem with my patch: `org-at-regexp-p' does not match over > multiple lines. Maybe you can play with `org-in-regexp': > > (org-in-regexp org-capture-template-embedded-elisp-re 3) > > If using `forward-sexp' is necessary let's do so -- but I thought it > was too complex first. When I wrote the patch my conclusion was that regexp alone is not sufficient. For real feed templates used by me, not only for artificial examples. I must admit that my solution with `forward-sexp' is complicated but it makes available the power of the Emacs Lisp Mode parser. Maybe there are still some simplifications? Michael