From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafael Laboissiere Subject: Re: [PATCH] call_*() is not working inside #+DATE Date: Sat, 12 Mar 2016 08:57:04 +0100 Message-ID: <20160312075704.GI16308@laboissiere.net> References: <20160307015829.GE11627@laboissiere.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tNQTSEo8WG/FKZ8E" Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeeQB-0007oQ-KB for emacs-orgmode@gnu.org; Sat, 12 Mar 2016 02:57:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeeQ6-0007pq-JW for emacs-orgmode@gnu.org; Sat, 12 Mar 2016 02:57:11 -0500 Received: from laboissiere.net ([46.101.243.132]:43688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeeQ6-0007pe-C9 for emacs-orgmode@gnu.org; Sat, 12 Mar 2016 02:57:06 -0500 Content-Disposition: inline In-Reply-To: <20160307015829.GE11627@laboissiere.net> 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: emacs-orgmode@gnu.org --tNQTSEo8WG/FKZ8E Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit * Rafael Laboissiere [2016-03-07 02:58]: > The following used to work for me in the past: > > #+NAME: date > #+BEGIN_SRC sh :results silent :exports results :tangle no > date > #+END_SRC > #+TITLE: Sample > #+AUTHOR: Me > #+DATE: call_date() > > and I saw the output of the shell command "date" when exporting the > file to LaTeX. However does not work for the current HEAD of the Git > repository. > > Using git-bisect, I discovered that the culprit is commit 85ff663, > i.e. my code above works for commit 85ff663^ but fails for commit > 85ff663. > > Commit 85ff663 was a pretty large commit and, besides that, the new > code introduced by it was posteriorly changed, so it is hard to find > where the bug comes from. Could someone more acquainted with the code > try to look at this bug, please? I investigated this issue further and discovered that the constructs call_(args) and src_{code} are not evaluated at all when they appear in a keyword line (starting with "#+:"). Org-babel behaves in this way probably on purpose. At any rate, it would be better if the current behavior is documented somewhere. This may be accomplished with the patch attached below. Best, Rafael Laboissière P.S.: For those who are reading this message and are interested in a solution for my original problem, here is the way I am getting around it right now. When exporting to LaTeX, I wanted to have, as the contents of the \date{} macro, the date and the hash of the last Git commit of the current checkout HEAD, to which my Org document belongs. Here is how I am doing it now: #+TITLE: Sample #+AUTHOR: Me #+BEGIN_SRC sh :results silent :exports results :tangle no git show -s --date=short --format="%cd [%h]" HEAD > GitDateCommit.tex #+END_SRC #+DATE: \input{GitDateCommit} --tNQTSEo8WG/FKZ8E Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Document-lack-of-evaluation-of-inline-code-blocks-in.patch" >From fa47439f9897c4bab436ecf4c9f08fa686ff0231 Mon Sep 17 00:00:00 2001 From: Rafael Laboissiere Date: Fri, 11 Mar 2016 23:04:00 +0100 Subject: [PATCH] Document lack of evaluation of inline code blocks in keyword lines doc/org.texi (Evaluating code blocks): Add footnote explaining that inline code blocks are not evaluated inside keyword lines. --- doc/org.texi | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index e423df7..ce478f5 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -15030,13 +15030,16 @@ evaluation from the @kbd{C-c C-c} key binding.}. This will call the its results into the Org mode buffer. @cindex #+CALL -It is also possible to evaluate named code blocks from anywhere in an Org -mode buffer or an Org mode table. These named code blocks can be located in -the current Org mode buffer or in the ``Library of Babel'' (@pxref{Library of -Babel}). Named code blocks can be evaluated with a separate @code{#+CALL:} -line or inline within a block of text. In both cases the result is wrapped -according to the value of @code{org-babel-inline-result-wrap}, which by -default is @code{"=%s="} for markup that produces verbatim text. +It is also possible to evaluate named code blocks from +anywhere@footnote{Actually, the constructs call_() and src_@{@} +are not evaluated when they appear in a keyword line (i.e. lines starting +with @code{#+KEYWORD:}, @pxref{In-buffer settings}).} in an Org mode buffer +or an Org mode table. These named code blocks can be located in the current +Org mode buffer or in the ``Library of Babel'' (@pxref{Library of Babel}). +Named code blocks can be evaluated with a separate @code{#+CALL:} line or +inline within a block of text. In both cases the result is wrapped according +to the value of @code{org-babel-inline-result-wrap}, which by default is +@code{"=%s="} for markup that produces verbatim text. The syntax of the @code{#+CALL:} line is -- 2.7.0 --tNQTSEo8WG/FKZ8E--