emacs-devel
[Top][All Lists]
Advanced

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

Re: Font Locking issue: Need help/advice


From: Serghei
Subject: Re: Font Locking issue: Need help/advice
Date: Sun, 05 Apr 2020 14:37:05 +0000

> > -   What happens on the GIF? How I can fix this? How to avoid similar
> >     in the future?
> >
>
> What happens here is that the initial font-lock goes over the whole
> currently visible section, but as soon as you edit one line, font-lock
> will be called only for the part of the buffer that has changed, and it
> seems your font-lock rules work differently in this case because the
> context has changed.

Although I didn't receive answers to all my questions in this
thread, your suggestion about inconsistent font-lock rules turned
out as a clue.  I found that even if I delete all other font-lock
rules (except this one), the problem will still remain.  And I
decided to refactor it from scratch.  After more careful refactor of
this anchored font-lock matcher, I was able to optimize some of its
parts [1].  Now it works as expected.  Thanks for the tip!

Well, parsing complex context sensitive languages with a bunch of
very weak regexes is not a good idea.  Anchored font-lock matchers
certainly help but still seem like a complicated approach.

> For better understanding how font-lock actually works, I highly
> recommend using font-lock-studio
>
> https://github.com/Lindydancer/font-lock-studio

I have heard about this package several times over the past few
years.  However, I still lack some simple instructions on how to
find font-lock issues using this package.  Perhaps a small guide
with an example of finding font-lock problems would help.


[1]: 
https://github.com/zephir-lang/zephir-mode/pull/28/commits/52ff40451b565d3f4a10b30e9c71e136b7d60021

--
Serghei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]