From: Rafael Laboissiere <rafael@laboissiere.net>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] call_*() is not working inside #+DATE
Date: Sat, 12 Mar 2016 08:57:04 +0100 [thread overview]
Message-ID: <20160312075704.GI16308@laboissiere.net> (raw)
In-Reply-To: <20160307015829.GE11627@laboissiere.net>
[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]
* Rafael Laboissiere <rafael@laboissiere.net> [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_<name>(args) and src_<lang>{code} are not evaluated at all when they
appear in a keyword line (starting with "#+<keyword>:"). 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}
[-- Attachment #2: 0001-Document-lack-of-evaluation-of-inline-code-blocks-in.patch --]
[-- Type: text/x-diff, Size: 2030 bytes --]
From fa47439f9897c4bab436ecf4c9f08fa686ff0231 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere <rafael@laboissiere.net>
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_<name>() and src_<lang>@{@}
+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
next prev parent reply other threads:[~2016-03-12 7:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 1:58 call_*() is not working inside #+DATE Rafael Laboissiere
2016-03-12 7:57 ` Rafael Laboissiere [this message]
2016-03-12 8:51 ` [PATCH] " Eric S Fraga
2016-03-12 9:34 ` Rafael Laboissiere
2016-03-13 17:24 ` Nicolas Goaziou
2016-03-13 17:41 ` Rafael Laboissiere
2016-03-14 16:43 ` Rafael Laboissiere
2016-03-14 19:41 ` Nicolas Goaziou
2016-03-15 10:23 ` Rafael Laboissiere
2016-03-15 18:50 ` Nicolas Goaziou
2016-03-15 20:58 ` Rafael Laboissiere
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160312075704.GI16308@laboissiere.net \
--to=rafael@laboissiere.net \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.