From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Why is jit-lock-stealth-time nil by default?
Date: Thu, 17 Feb 2022 09:58:40 +0200 [thread overview]
Message-ID: <83h78x2abz.fsf@gnu.org> (raw)
In-Reply-To: <JtCtsb7d-qX3FsAmZvneVgWH6D3-193MEyrQ8GxJI10xI2C3HGjqGn8q-uxXrqCQOeEohEWWngJfG-Msj63XlJcV_ynUZflLZsVXdwJaJ7o=@protonmail.com> (message from emacsq via Users list for the GNU Emacs text editor on Thu, 17 Feb 2022 06:58:09 +0000)
> 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.
prev parent reply other threads:[~2022-02-17 7:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 6:26 Why is jit-lock-stealth-time nil by default? emacsq via Users list for the GNU Emacs text editor
2022-02-17 6:44 ` Eli Zaretskii
2022-02-17 6:58 ` emacsq via Users list for the GNU Emacs text editor
2022-02-17 7:58 ` Eli Zaretskii [this message]
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=83h78x2abz.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@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.
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).