all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Rafael Laboissiere <rafael@laboissiere.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] call_*() is not working inside #+DATE
Date: Sun, 13 Mar 2016 18:24:42 +0100	[thread overview]
Message-ID: <87y49mmgth.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <20160312093451.GL16308@laboissiere.net> (Rafael Laboissiere's message of "Sat, 12 Mar 2016 10:34:51 +0100")

Hello,

Rafael Laboissiere <rafael@laboissiere.net> writes:

> It would be much better if the following construct worked:
>
>     #+DATE: src_sh{git show -s --date=short --format="%cd [%h]" HEAD}
>
> Unfortunately, it does not.  This behavior (or misbehavior, I do not 
> know) can be traced down to the org-element-context function.  Suppose 
> 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, 
> org-element-context returns:
>
>     (keyword
>      (:key "DATE" :value "src_sh{date}" :begin 1 :end 22 :post-blank 0 :post-affiliated 1 :parent nil))
>
> On the other hand, with the cursor just after the underscore in the next 
> line, org-element-context returns (as it should be):
>
>     (inline-src-block
>      (:language "sh" :value "date" :parameters nil :begin 22 :end  34 :post-blank 0
>        :parent (paragraph (:begin 22 :end 35 :contents-begin 22 :contents-end 35 :post-blank 0
>                            :post-affiliated 22 :parent nil))))
>
> This is the reason why Org-babel does not evaluate the inline source 
> 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,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-03-13 17:22 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 ` [PATCH] " Rafael Laboissiere
2016-03-12  8:51   ` Eric S Fraga
2016-03-12  9:34     ` Rafael Laboissiere
2016-03-13 17:24       ` Nicolas Goaziou [this message]
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=87y49mmgth.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=rafael@laboissiere.net \
    /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.