unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Harald Kirsch <pifpafpuf@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: Any expert on font-lock machinery able to provide some insight
Date: Fri, 03 Jan 2025 13:58:03 +0200	[thread overview]
Message-ID: <86ikqwgldg.fsf@gnu.org> (raw)
In-Reply-To: <67d9db0a-ba0f-4164-83fd-796089a6e40b@gmx.de> (message from Harald Kirsch on Fri, 3 Jan 2025 11:26:11 +0100)

> Date: Fri, 3 Jan 2025 11:26:11 +0100
> From: Harald Kirsch <pifpafpuf@gmx.de>
> 
> Hi font-lock experts?
> 
> I am working on a font-lock function and see it called by the jit-lock
> timer at weird times.
> 
> I see a normal font-lock function call after a change, for example when
> inserting a character. But then I see
> 
> - calls when moving the cursor (no scroll)
> - when setting the mark
> - when moving the mouse into **another** frame
> - when moving the mouse into yet **another** frame

This is expected.  Lisp programs sometimes need to make layout
calculations for some reason.  For example, when you move the cursor
with C-f, Emacs needs to know the buffer position that corresponds to
the character to the right of the previous one.  Since you can have
several different faces and fonts in a buffer, the answer to that
question needs to execute some of the layout code that is part of the
display engine, and that will call jit-lock if the corresponding
region of the buffer text was not yet fontified.

> I understand that when the function does not return
> 
>    (jit-lock-bounds beg . end)
> 
> jit-lock assumes the region was fontified just fine. For completeness I
> also added the an explicit (jit-lock-bounds beg . end) return to my
> font-lock function. Same behavior.
> 
> But it seems I am missing another channel of information which triggers
> font-locking too often.

Why does it bother you that it happens too often?

> With describe-char I do see
> 
> There are text properties here:
>    fontified            defer
> 
> not going away. Can this point to the problem?

This should only happen with buffer positions that were not yet
fontified.  If the buffer position was already fontified, the value
should be t.



  reply	other threads:[~2025-01-03 11:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03 10:26 Any expert on font-lock machinery able to provide some insight Harald Kirsch
2025-01-03 11:58 ` Eli Zaretskii [this message]
     [not found]   ` <91114d5a-4af9-4ae1-b7c9-b673e5edf25e@gmx.de>
2025-01-03 13:32     ` Eli Zaretskii
2025-01-03 13:57       ` Harald Kirsch
2025-01-03 16:09         ` Any expert on font-lock machinery able to provide some insight --- problem solved Harald Kirsch
2025-01-03 14:42       ` Any expert on font-lock machinery able to provide some insight John ff

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=86ikqwgldg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=pifpafpuf@gmx.de \
    /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.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).