[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] org-babel-demarcate-block: split using org-element instead o
From: |
gerard . vermeulen |
Subject: |
Re: [PATCH] org-babel-demarcate-block: split using org-element instead of regexp |
Date: |
Tue, 02 Jan 2024 20:20:00 +0000 |
On 02.01.2024 11:48, Ihor Radchenko wrote:
gerard.vermeulen@posteo.net writes:
[...]
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.
[...]
(org-babel--get-vars (nth 2 (org-babel-get-src-block-info)))
Attached you'll find a new patch trying to implement your suggestions.
Interactive splitting by demarcation seems to work quite well (see the
before and after splitting snippets in the PS).
However, I cannot run the test because org-babel-demarcate-block
always errors "org-element--cache: Emergency exit" while the same
input works interactively. Could there be a problem of cache
synchronization or something like that? Is there something I can do?
I also did not yet look into how to propagate a switch like -n10.
PS:
# begin before splitting snippet
#+caption[Demarcation splitting test]:
#+caption: Demarcation splitting test.
#+header: :var edge="also copied"
#+header: :wrap "src any-spanish -n"
#+name: lst:test
#+begin_src python -i -n :var here="copied" :wrap "src any-english -n"
# above-split
# below-split
#+end_src
# end before splitting snippet
# begin after splitting snippet
#+caption[Demarcation splitting test]:
#+caption: Demarcation splitting test.
#+header: :var edge="also copied"
#+header: :wrap "src any-spanish -n"
#+name: lst:test
#+begin_src python -i -n :var here="copied" :wrap "src any-english -n"
# above-split
#+end_src
#+header: :var edge="also copied"
#+header: :wrap "src any-spanish -n"
#+begin_src python -i -n :var here="copied" :wrap "src any-english -n"
# below-split
#+end_src
# end after splitting snippet
0001-org-babel-demarcate-block-split-using-org-element-in.patch
Description: Binary data
- Re: [PATCH] org-babel-demarcate-block: duplicate switches too, gerard . vermeulen, 2024/01/01
- Re: [PATCH] org-babel-demarcate-block: duplicate switches too, Ihor Radchenko, 2024/01/02
- Re: [PATCH] org-babel-demarcate-block: split using org-element instead of regexp,
gerard . vermeulen <=
- Re: [PATCH] org-babel-demarcate-block: split using org-element instead of regexp, Ihor Radchenko, 2024/01/03
- Re: [PATCH] org-babel-demarcate-block: split using org-element instead of regexp, gerard . vermeulen, 2024/01/04
- Re: [PATCH] org-babel-demarcate-block: split using org-element instead of regexp, Ihor Radchenko, 2024/01/04
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/07
- Re: [PATCH] org-babel-demarcate-block: split using element API, Ihor Radchenko, 2024/01/08
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/08
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/09
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/09
- Re: [PATCH] org-babel-demarcate-block: split using element API, Ihor Radchenko, 2024/01/09
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/13