all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: David Engster <deng@randomsample.de>
Cc: Serghei Iakovlev <egrep@protonmail.ch>,
	GNU Emacs Developers <emacs-devel@gnu.org>
Subject: Re: Font Locking issue: Need help/advice
Date: Fri, 3 Apr 2020 19:48:02 -0400	[thread overview]
Message-ID: <C2C01D40-63C7-4F4F-8E5B-1420A3766395@gmail.com> (raw)
In-Reply-To: <877dyw2o3a.fsf@randomsample>



> On Apr 3, 2020, at 6:36 PM, David Engster <deng@randomsample.de> wrote:
> 
>> - 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.
> 
>> - In fact, I would like to be able to independently receive the
>>  answer to the question "Why did this happen?" so I'm interesting
>>  on debugging practices.  How to debug similar issues?
> 
> For better understanding how font-lock actually works, I highly
> recommend using font-lock-studio
> 
> https://github.com/Lindydancer/font-lock-studio
> 
> Also, take a look at the other linked packages in the description. In
> your case, 'highlight-refontification' could be useful to see which
> parts of the buffer actually get refontified when you edit it.
> 
> -David
> 

It is also helpful to look at jit-lock.el since that’s the default on-the-fly fortification facility. Basically it marks all text after the changed region (including the region) as “unfontified” when you edit the buffer. And the redisplay (C) code will call jit-lock functions (which calls font-lock functions) to fontify the unfontified text when it needs to display them. IIUC jit-lock is given chunks of unfontified text (several thousand characters) each time. 

Yuan






  reply	other threads:[~2020-04-03 23:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 12:29 Font Locking issue: Need help/advice Serghei Iakovlev
2020-04-03 18:27 ` Stephen Leake
2020-04-03 22:20   ` Serghei
2020-04-04  0:21     ` Stephen Leake
2020-04-03 22:36 ` David Engster
2020-04-03 23:48   ` Yuan Fu [this message]
2020-04-05 14:37   ` Serghei

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C2C01D40-63C7-4F4F-8E5B-1420A3766395@gmail.com \
    --to=casouri@gmail.com \
    --cc=deng@randomsample.de \
    --cc=egrep@protonmail.ch \
    --cc=emacs-devel@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.