emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] org-babel-demarcate-block: duplicate switches too


From: Ihor Radchenko
Subject: Re: [PATCH] org-babel-demarcate-block: duplicate switches too
Date: Tue, 02 Jan 2024 10:48:29 +0000

gerard.vermeulen@posteo.net writes:

>> Thanks for the patch!
>> Would you mind also adding a test for `org-babel-demarcate-block' in
>> testing/lisp/test-ob.el?
>
> I have attached a new patch with a test named 
> `test-ob/demarcate-block-split'.
> Besides testing the duplication of switches and some header arguments, 
> it also
> shows that multi-line header arguments are not duplicated.
>
> Whether this is a bug or a feature in `org-babel-demarcate-block' may be 
> a
> point of discussion. I have no real opinion.

IMHO, this is a bug.
The current approach with regexp matching in `org-babel-demarcate-block'
is clearly not accurate. What would be more robust is using
org-element-at-point + org-element-copy + set :value +
org-element-interpret-data to carry over all the affiliated keywords and
header arguments.

> The code of the 4 (should ...) forms in the test below the line
> ;; unduplicated multi-line header arguments:
> feels a bit clumsy. Does Org have a function to extract the value that a 
> particular
> var-name has from the association list returned by 
> `org-babel-get-src-block-info'?

(org-babel--get-vars (nth 2 (org-babel-get-src-block-info)))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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