help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Why is jit-lock-stealth-time nil by default?


From: Eli Zaretskii
Subject: Re: Why is jit-lock-stealth-time nil by default?
Date: Thu, 17 Feb 2022 09:58:40 +0200

> Date: Thu, 17 Feb 2022 06:58:09 +0000
> From:  emacsq via Users list for the GNU Emacs text editor 
> <help-gnu-emacs@gnu.org>
> 
> > That shouldn't happen.  Emacs uses a JIT fontification feature, which
> > is turned on by default, and which should make sure any part of the
> > buffer is always fontified before it is displayed.
> 
> Is it also true for programmatic features, that is if the user himself 
> doesn't visit those parts, only elisp routines go there and show parts of the 
> buffer? E.g. 'peek' features which fetch unvisited parts of a buffer and show 
> them to the user in a tooltip? I thought JIT does not fontificates those 
> parts.

JIT fontification works at display time.  If a Lisp program shows
portions of the buffer in a tooltip, the fontification will still
happen when the tooltip is displayed (assuming you don't use GTK
tooltips), but it will use the rules according to the major mode of
the buffer you show in the tooltip, which will probably be different
from what you expect.

But note that jit-lock-stealth fontifications will not necessarily
solve this problem, because you have no control on the order and the
timing of the stealth fontifications.  So it could well be that by the
time you show some portion of the buffer in a tooltip, stealth
fontifications for that part didn't yet happen.

If you want to ensure the portion of the buffer you are about to
display is fontified, call font-lock-fontify-region or
font-lock-ensure just before showing the tooltip.



reply via email to

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