Hello org-mode maintainers,

With org-hide-emphasis-markers enabled, I am running into a
number of situations where characters inside inline code and verbatim strings are made invisible.

The one I am hitting constantly is when a code string contains "~"
before a letter or other significant character.
If you write the string

    ~(A & ~B)~

Emacs will display this as

    (A & B)

I can add another "~" where the other one disappeared,
and that will remain visible.

    ~(A & ~~B)~

displays as

    (A & ~B)

Only when exporting does it reveal the true content, the double "~".

    `(A & ~~B)'


The same kind of behavior happens with verbatim strings. Writing

    =(A =B)=

displays as

    (A B)


I have also occasionally seen this happening to other characters inside
code/verbatim strings. In the example I was able to reproduce, I can
type

    ~A /-> B~ is /almost/

and Emacs displays

    A -> B is almost

Emacs also italicizes "-> B is almost".

The behavior here is harder to reproduce; if I initially instead write
it as

    ~A /-> B~
    is /almost/

it displays exactly as expected, but as soon as I then try to add a
second slash to make "//->", one slash disappears, and everything from
"/->" to the end is italicized.

    A /-> B
    is almost


If I write it initially with "//->", it initially displays
as expected, and the above effect does not happen until I try to
edit the code string - editing it makes characters start to disappear.

Exporting to text again reveals the true content with the missing
characters.


I was able to reproduce this kind of behavior in inline src_ blocks as
well; if I write

    src_text{~~A~}

it displays as

    src_text{~A}


I reproduced all of this with "emacs -Q" on org-mode 9.8.7,
but also on 9.8.9 (without "-Q").


What I would expect to happen is that the contents of any sort of
verbatim, code, src_, or similar string
should have no effect on formatting, or at the very least no characters
should ever disappear from inside them.


Finally, I am not sure whether or not this is related, as it happens
regardless of org-hide-emphasis-markers, but just in case it is,
the cluster "'~," when ending a code string, seems to mess up what
gets formatted as code. The general pattern is text, then some code ending in apostrophe, then following the "~" with a comma,
and then a second code string on the same line. For example,

    Then ~a'~, is ~b~

What happens is the whole segment "a', is b" gets formatted as code
(if org-hide-emphasis-markers is on, all "~" disappear). Deleting the apostrophe
causes the line to be formatted as expected.

------------------------------------------------------------------------

Emacs  : GNU Emacs 31.1 (build 2, x86_64-w64-mingw32)
 of 2026-08-24
Package: Org mode version 9.8.7 (release_9.8.7 @ c:/Program Files/Emacs/emacs-31.1/share/emacs/31.1/lisp/org/)


Reply via email to