emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] Incorrect fontification of src blocks for indentation sensitiv


From: Ihor Radchenko
Subject: Re: [BUG] Incorrect fontification of src blocks for indentation sensitive language modes
Date: Wed, 17 Aug 2022 17:39:24 +0800

Bhavin Gandhi <bhavin7392@gmail.com> writes:

> In the following Org mode file, the Ledger mode source block is not
> highlighted correctly.
>
> How to reproduce:
> ...

Confirmed.
Another example is
https://www.reddit.com/r/orgmode/comments/wi0jq9/highlight_doesnt_work_for_src_block_of_diff_with/

> PS: I haven't looked at the code of org-src-font-lock-fontify-block in
> detail, so I could be wrong with this analysis.

`org-src-font-lock-fontify-block' is indeed the culprit. It copies the
text between begin/end markers verbatim without adjusting the
indentation. The proper way would be using an approach similar to
`org-edit-src-code', but it may be tricky to map the fontification back
into the original block without a need to delete/re-insert the code into
Org buffer. Editing during fontification is a bad idea, so some kind of
smarter approach should be used in order to fix this.

P.S. I am genuinely surprised that this bug is only revealed now.

-- 
Ihor Radchenko,
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]