emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] (Maybe) enhance `org-element-src-block-interpreter'?


From: Nicolas Goaziou
Subject: Re: [O] (Maybe) enhance `org-element-src-block-interpreter'?
Date: Wed, 06 Aug 2014 13:34:20 +0200

Hello,

Thorsten Jolitz <address@hidden> writes:

> Aaron Ecay <address@hidden> writes:
>
>> Hi Thorsten,
>>
>> 2014ko abuztuak 5an, Thorsten Jolitz-ek idatzi zuen:
>>
>> [...]
>>
>>> 
>>> Parse this src-block (with point at beg of block):
>>> 
>>> ,----
>>> | M-: (setq ptree (org-element-at-point))
>>> `----
>>> 
>>> #+header: :results raw
>>> #+begin_src emacs-lisp
>>> (message "hello world")
>>> #+end_src
>>> 
>>> #+results:
>>> hello world
>>> 
>>> Then evaluate
>>> 
>>> #+begin_src emacs-lisp
>>> (org-element-src-block-interpreter ptree nil)
>>> #+end_src
>>> 
>>> #+results:
>>> : #+BEGIN_SRC emacs-lisp
>>> :   (message "hello world")
>>> : #+END_SRC
>>> 
>>> #+begin_src emacs-lisp
>>> (tj/src-block-interpreter ptree nil)
>>> #+end_src
>>> 
>>> #+results:
>>> : #+HEADER: :results raw
>>> : #+BEGIN_SRC emacs-lisp
>>> :   (message "hello world")
>>> : #+END_SRC
>>
>> Indeed this seems like an improvement on the status quo.  But other
>> elements of org syntax (not just src blocks) can have a valid #+header
>> (and indeed other affiliated keywords, like #+attr_latex), so the fix
>> probably should be more general.
>
> Yes, there are other elements and more affiliated keywords. The
> parser (or rather the interpreter(s)) and parts of Org Babel do not
> always deal with them yet. 
>
> This was more a 'constructive bug report', not so much an attempt of a
> general fix. I just (partly) fixed this function for myself because I
> needed it ...

There is no bug here.

`org-element-src-block-interpreter' is meant to create a src block and
only a src block. `org-element--interpret-affiliated-keyword' is used to
create affiliated keywords (like "#+header"). You shouldn't call any of
these anyway, since `org-element-interpret-data' is the one and only
entry point to interpret parsed data. Try


  (org-element-interpret-data ptree)


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]