emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Inheriting some local variables from source code block editing b


From: Göktuğ Kayaalp
Subject: Re: [O] Inheriting some local variables from source code block editing buffers
Date: Mon, 14 May 2018 19:34:39 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On 2018-05-14 14:13 +02, Nicolas Goaziou <address@hidden> wrote:
> You shouldn't add another "attr" keyword, which is reserved for export
> back-ends. Actually, every Babel header can be located either on the
> block opening line, e.g.,
>
>     #+begin_src emacs-lisp :some-property some-value
>
> or as an affiliated #+header: keyword, e.g.,
>
>     #+header: :some-property some-value
>     #+begin_src emacs-lisp
>
>
> Note that "#+header:" keywords are supported everywhere, without
> modifying the parser, e.g.,
>
>     #+header: :some-property some-value
>     A paragraph.

The attr was meant for BEGIN_EXPORT blocks because it seems to me that
an equivalent of ‘org-babel-get-src-block-info’ does not exist for those
blocks, and that function _only_ works with BEGIN_SRC blocks.  Is there
a function available or would I have to write one to do this?

Looking all over the Org manual searching for BEGIN_(LATEX|HTML), I
haven't seen once a header argument used with a block that is not a
BEGIN_SRC block, in neither of the forms.  And none of the ‘org-edit-*’
functions apart from ‘org-edit-src-code’ in org-src.el seem to process
header arguments, and nor does ‘org-src--edit-element’.

I can't find any documentation on Org-mode's internal APIs and how
different parts fit together, so I'm having to figure things out reading
source code.

The following form returns nil for the following examples:

(plist-get :header (cadr (org-element-at-point))) ;=> nil

(cl-remove-if-not #'symbolp (cadr (org-element-at-point)))
  ;=> (:type :begin :end :value :post-blank :post-affiliated :header
       :parent nil)

#+header: :edit-bindings '((lexical-binding t))
#+BEGIN_EXPORT latex
#+END_EXPORT

#+BEGIN_EXPORT latex :edit-bindings '((lexical-binding t))
#+END_EXPORT

#+BEGIN_SRC elisp :edit-bindings '((lexical-binding t))
#+END_SRC

#+header: :edit-bindings '((lexical-binding t))
#+BEGIN_SRC elisp
#+END_SRC

> Also, for integration in Org mode proper, some testing would be more
> than welcome

If this feature will be included upstream, I can make this into a patch
instead of an advice and add the related docs and tests.  This was meant
as a concrete example of the concept.

-- 
İ. Göktuğ Kayaalp       <https://www.gkayaalp.com/>
                         024C 30DD 597D 142B 49AC
                         40EB 465C D949 B101 2427



reply via email to

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