[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Highlight ANSI sequences in the whole buffer (was [PATCH] A
From: |
Nathaniel Nicandro |
Subject: |
Re: [PATCH] Highlight ANSI sequences in the whole buffer (was [PATCH] ANSI color on example blocks and fixed width elements) |
Date: |
Sun, 24 Dec 2023 06:49:56 -0600 |
User-agent: |
mu4e 1.8.13; emacs 30.0.50 |
Ihor Radchenko <yantar92@posteo.net> writes:
> It runs fine on my side, although I am not sure if things are working as
> expected for all the cases. For example, headlines never got fontified
> on my side when I tried your patch on top of the latest main branch.
Yes, the headlines are currently not fontified since, with this patch, I
was mainly looking to satisfy the initial set of rules you laid out
which didn't mention headlines as being a fontifiable element for ANSI
sequences, or at least I didn't get that from my reading of them.
It does make sense, however, to be able to add headlines to the
`org-ansi-highlightable-elements` variable so that they are fontified if
the user wishes. Although doing so with this patch wouldn't work.
> Also, it looks like you simply made the ASCII sequences invisible, which
> causes funky behaviour when trying to edit the text around. What we may
> need instead is something similar to hidden parts of the links that get
> revealed when we try to edit the invisible text. See
> `org-catch-invisible-edits' variable and the functions that examine it.
I agree that we should reveal the invisible sequence when trying to edit
it.
Thanks for the tip about `org-catch-invisible-edits', it led me to
`org-fold-show-set-visibility' which I think is the appropriate place to
reveal a hidden sequence.
> You may use `org-fontify-extend-region' to handle such scenarios if you
> mark the ANSI highlights with a special text property.
Thanks for the tip, I'll look into it.
--
Nathaniel