From: Ihor Radchenko <yantar92@gmail.com>
To: Bhavin Gandhi <bhavin7392@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Incorrect fontification of src blocks for indentation sensitive language modes
Date: Wed, 17 Aug 2022 17:39:24 +0800 [thread overview]
Message-ID: <87czcz1a5v.fsf@localhost> (raw)
In-Reply-To: <CAOn=hbevUMGS0-qMTy8kB4-db65s1Tmn0cQJcw8b++PZZ=vULA@mail.gmail.com>
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
next prev parent reply other threads:[~2022-08-17 9:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 17:47 [BUG] Incorrect fontification of src blocks for indentation sensitive language modes Bhavin Gandhi
2022-08-17 9:39 ` Ihor Radchenko [this message]
2022-08-17 11:42 ` Fraga, Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czcz1a5v.fsf@localhost \
--to=yantar92@gmail.com \
--cc=bhavin7392@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).