emacs-orgmode
[Top][All Lists]
Advanced

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

[BUG] Null character in block/drawer regexps (but not in org-element par


From: Ihor Radchenko
Subject: [BUG] Null character in block/drawer regexps (but not in org-element parser) (was: BUG? Null character prevents org-babel-tangle from tangling a block)
Date: Sat, 12 Nov 2022 12:59:40 +0000

Tommy Kelly <tommy.kelly@verilab.com> writes:

> The attached .org file describes a simple test to demonstrate the problem.
> I've also attached a .zip version, in case the NULL character in the test
> doesn't survive the gmailing process. (The null is In BLOCK 2, two
> characters after the '3' in ';; line3' If it's there, you should see the
> usual ^@ (as a single character) placeholder.

Confirmed.

This is because `org-babel-src-block-regexp' explicitly prohibits null
characters in the body. Similar situation is with `org-block-regexp',
`org-clock-drawer-re', `org-latex-regexps', and a number of other places
in Org sources.

At least for src blocks, prohibiting null character is inconsistent with
org-element parser. I am not very sure what is the rationale behind now
allowing null character. I see no clues in git history and a single
possibly relevant comment in `org-latex-regexps':

  ;; \000 in the following regexp is needed for org-inside-LaTeX-fragment-p

However, `org-inside-LaTeX-fragment-p' itself is outdated and needs
to be replaced with org-element machinery.

So, we should probably remove zero-width shenanigans from the code.

Unless I miss something.

Bastien, maybe you recall something about presence of null character in
regexs?

P.S. If we decide to remove the null character, I'd prefer to do it
after the release: this change may affect a lot of code and the bug is
not that major to risk breakage.

-- 
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]