unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why is jit-lock-stealth-time nil by default?
@ 2022-02-17  6:26 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
  0 siblings, 2 replies; 4+ messages in thread
From: emacsq via Users list for the GNU Emacs text editor @ 2022-02-17  6:26 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

I use commands which can show unvisited parts of a buffer and I find it
annoying when those parts are not fontified.

I looked into it and found stealth font locking which performs fontification
of those parts when the user is idle.

But jit-lock-stealth-time is nil by default. Is there a reason for this? It's a useful
feature and today's computers have plenty of idle time, so why is not enabled
out of the box?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why is jit-lock-stealth-time nil by default?
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2022-02-17  6:44 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 17 Feb 2022 06:26:31 +0000
> From:  emacsq via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> I use commands which can show unvisited parts of a buffer and I find it
> annoying when those parts are not fontified.

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.  So please report
these cases as bugs, preferably with a reproduction recipe that starts
from "emacs -Q".

> I looked into it and found stealth font locking which performs fontification
> of those parts when the user is idle.
> 
> But jit-lock-stealth-time is nil by default. Is there a reason for this? It's a useful
> feature and today's computers have plenty of idle time, so why is not enabled
> out of the box?

It isn't the default because not many people like or use it.  (I do
like it and always use it, FWIW.)  One problem with this is that it
will cause Emacs to use CPU resources when Emacs is idle, which could
drain the batteries in laptops.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why is jit-lock-stealth-time nil by default?
  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
  1 sibling, 1 reply; 4+ messages in thread
From: emacsq via Users list for the GNU Emacs text editor @ 2022-02-17  6:58 UTC (permalink / raw)
  To: 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.

------- Original Message -------
On Thursday, February 17th, 2022 at 7:26 AM, emacsq <laszlomail@protonmail.com> wrote:

> I use commands which can show unvisited parts of a buffer and I find it
> annoying when those parts are not fontified.
>
> I looked into it and found stealth font locking which performs fontification
> of those parts when the user is idle.
>
> But jit-lock-stealth-time is nil by default. Is there a reason for this? It's a useful
> feature and today's computers have plenty of idle time, so why is not enabled
> out of the box?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why is jit-lock-stealth-time nil by default?
  2022-02-17  6:58 ` emacsq via Users list for the GNU Emacs text editor
@ 2022-02-17  7:58   ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2022-02-17  7:58 UTC (permalink / raw)
  To: help-gnu-emacs

> 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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-17  7:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).