From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] call_*() is not working inside #+DATE Date: Sun, 13 Mar 2016 18:24:42 +0100 Message-ID: <87y49mmgth.fsf@nicolasgoaziou.fr> References: <20160307015829.GE11627@laboissiere.net> <20160312075704.GI16308@laboissiere.net> <877fh8oz9g.fsf@ucl.ac.uk> <20160312093451.GL16308@laboissiere.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1af9iv-0002pL-Gn for emacs-orgmode@gnu.org; Sun, 13 Mar 2016 13:22:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1af9iu-0005AC-AW for emacs-orgmode@gnu.org; Sun, 13 Mar 2016 13:22:37 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:43629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1af9iu-0005A3-4S for emacs-orgmode@gnu.org; Sun, 13 Mar 2016 13:22:36 -0400 In-Reply-To: <20160312093451.GL16308@laboissiere.net> (Rafael Laboissiere's message of "Sat, 12 Mar 2016 10:34:51 +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: Rafael Laboissiere Cc: emacs-orgmode@gnu.org Hello, Rafael Laboissiere writes: > It would be much better if the following construct worked: > > #+DATE: src_sh{git show -s --date=3Dshort --format=3D"%cd [%h]" HEAD} > > Unfortunately, it does not. This behavior (or misbehavior, I do not=20 > know) can be traced down to the org-element-context function. Suppose=20 > that you have the following content in a org-mode buffer: > > #+DATE: src_sh{date} > src_sh{date} > > With the cursor just after the underscore in the #+DATE line,=20 > org-element-context returns: > > (keyword > (:key "DATE"=C2=A0:value "src_sh{date}"=C2=A0:begin 1=C2=A0:end 22= =C2=A0:post-blank 0=C2=A0:post-affiliated 1=C2=A0:parent nil)) > > On the other hand, with the cursor just after the underscore in the next= =20 > line, org-element-context returns (as it should be): > > (inline-src-block > (:language "sh"=C2=A0:value "date"=C2=A0:parameters nil=C2=A0:begin = 22=C2=A0:end 34=C2=A0:post-blank 0 > =C2=A0:parent (paragraph (:begin 22=C2=A0:end 35=C2=A0:contents-beg= in 22=C2=A0:contents-end 35=C2=A0:post-blank 0 > =C2=A0:post-affiliated 22=C2=A0:parent nil)))) > > This is the reason why Org-babel does not evaluate the inline source=20 > block in the #+DATE line. Values from keyword are not parsed. Org used to make an exception for an arbitrary bunch of them (e.g., DATE, TITLE, etc.). Now it is up to the export back-ends to decide what keyword is going to be parsed. I can think of two ways to solve this: 1. Only evaluate the Babel code during export. Upon exporting the document, parsed keywords are known, so `org-babel-exp-process-buffer' may try to find "hidden" Babel code and execute it. This would however introduce a discrepancy between org-babel-execute-buffer and the behaviour upon exporting. 2. Sort parsed keywords from regular ones at the syntax level, much like we did for export blocks recently. I.e., every keyword is parsed expect those marked as verbatim. I don't have an idea bout the involved syntax. This would probably induce some backward incompatibility. WDYT? Regards, --=20 Nicolas Goaziou