unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: psainty@orcon.net.nz, larsi@gnus.org, Emacs-hacker2018@jovi.net,
	45898@debbugs.gnu.org
Subject: bug#45898: 27.1; wedged in redisplay again
Date: Thu, 23 Jun 2022 09:08:10 +0300	[thread overview]
Message-ID: <837d57gbed.fsf@gnu.org> (raw)
In-Reply-To: <jwvmte4qnw4.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Wed, 22 Jun 2022 19:39:14 -0400)

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: larsi@gnus.org,  psainty@orcon.net.nz,  Emacs-hacker2018@jovi.net,
>   45898@debbugs.gnu.org
> Date: Wed, 22 Jun 2022 19:39:14 -0400
> 
> > Isn't there a way to limit what font-lock considers a "line" such that
> > it doesn't consider more than some number N of characters?  What could
> > potentially happen if we set N to, like, 10,000 characters?
> 
> Misfontification around that boundary.
> 
> > Are you saying that many regular expressions in font-lock-keywords are
> > anchored at beginning or end of a line?
> 
> No but for example if the 10000 char boundary falls in the middle of the
> word "function", then all the highlighting rules which rely on matching
> the keyword "function" will fail.

So we value accurate fontification more than we value a usable Emacs
session?  That sounds strange to me, since fontification is basically
a nicety, in the sense that it is not necessary for the text being
readable by humans.

To put this in perspective, I'm about to land a feature which, when
activated, will sometimes produce semi-updated windows (like incorrect
position of cursor) or even completely outdated windows (where what's
on the glass doesn't necessarily reflect where we are in the text,
like if you are at EOB, but the window still shows the last portion of
buffer text).  All that is done as a means to make Emacs usable even
when you for some reason visited a file with such pathologically long
lines.  If the weird results of redisplay under that feature are
acceptable in these extreme situations, I wonder why sacrificing
accuracy of font-lock wouldn't be.

> > And even if the regexp-based font-lock needs to do it line-by-line,
> > does it really _have_ to invoke parse-partial-sexp for the entire
> > line, when doing syntactical fontifications? why is that?
> 
> AFAICT this is a call that does
> 
>     (parse-partial-sexp (point) end nil nil state 'syntax-table)
> 
> where `end` happens to be point-max (because of font-lock's rounding up
> to whole lines) which will not itself parse all the way to `end` but
> will instead stop at the next string/comment boundary.  This is used
> (inside a loop which will indeed go all the way to `end`,
> i.e. `point-max`) to highlight strings and comments (as you can see
> from the stack trace, this is `font-lock-fontify-syntactically-region`).

Yes, that's what I see.

> For such huge files, it's arguably more important to be more-or-less
> usable than it is to get the highlighting right, so there's a good case
> for turning off font-lock or breaking it somewhat by using arbitrary
> limits in the handling of `font-lock-extend-region-functions` in
> `font-lock-default-fontify-region`.

I'm talking about cases where the user visits such files without
knowing in advance that he/she has better turned off font-lock there.
I'm asking whether one of the things we could do when we discover that
parse-partial-sexp is called for such a large chunk of text could be
automatic introduction of such a limit only for that buffer, so that
font-lock won't be such a significant part of the reason for redisplay
slowness in these cases.

Also, can you tell why visiting the same file in Text mode doesn't
produce the same effect?  I guess this is related to font-lock
settings of js.el, but my question is: would any mode that uses
syntactic fontification be similarly affected, or is there anything
special with js.el specifically?  IOW, is the above tendency to scan
everything to the end of line inherent in syntactic fontifications?

Thanks.





  reply	other threads:[~2022-06-23  6:08 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 18:13 bug#45898: 27.1; wedged in redisplay again Devon Sean McCullough
2022-06-07 13:37 ` Lars Ingebrigtsen
2022-06-07 14:00   ` Eli Zaretskii
     [not found]     ` <b7f81bfc-bbfb-83bc-3660-d0b1474498f7@jovi.net>
2022-06-07 15:53       ` Eli Zaretskii
2022-06-08 11:47     ` Lars Ingebrigtsen
2022-06-08 14:08       ` Eli Zaretskii
2022-06-08 15:58         ` Eli Zaretskii
2022-06-09 10:30           ` Lars Ingebrigtsen
2022-06-09 10:45             ` Eli Zaretskii
2022-06-09 11:04               ` Lars Ingebrigtsen
2022-06-09 13:09                 ` Eli Zaretskii
2022-06-09 13:36                   ` Lars Ingebrigtsen
2022-06-09 15:56                     ` Eli Zaretskii
2022-06-10  9:02                       ` Lars Ingebrigtsen
2022-06-12  9:48                         ` Eli Zaretskii
2022-06-12 10:23                           ` Lars Ingebrigtsen
2022-06-12 14:23                             ` Eli Zaretskii
2022-06-12 18:02                               ` Eli Zaretskii
2022-06-13 12:10                               ` Lars Ingebrigtsen
2022-06-13 12:57                                 ` Eli Zaretskii
2022-06-13 22:40                                   ` Phil Sainty
2022-06-14 12:45                                     ` Eli Zaretskii
2022-06-18  8:01                                       ` Eli Zaretskii
2022-06-20 11:58                                         ` Eli Zaretskii
2022-06-20 19:11                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-21 10:14                                             ` Eli Zaretskii
2022-06-21 20:38                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-22  2:33                                           ` Eli Zaretskii
2022-06-22 23:39                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-23  6:08                                               ` Eli Zaretskii [this message]
2022-06-23 21:14                                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-24  7:57                                                   ` Eli Zaretskii
2022-06-25  4:54                                                     ` Gerd Möllmann
2022-06-25  6:29                                                       ` Eli Zaretskii
2022-06-25  7:47                                                         ` Eli Zaretskii
2022-06-25  8:18                                                           ` Gerd Möllmann
2022-06-25  9:49                                                         ` Gerd Möllmann
2022-06-25  9:57                                                           ` Eli Zaretskii
2022-06-25 11:10                                                             ` Gerd Möllmann
2022-06-25 11:29                                                               ` Eli Zaretskii
2022-06-25 12:20                                                                 ` Gerd Möllmann
2022-06-25 12:54                                                                   ` Eli Zaretskii
2022-06-25 12:57                                                                     ` Gerd Möllmann
2022-06-29 16:18                                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 19:07                                                       ` Eli Zaretskii
2022-06-29 21:07                                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-30  5:14                                                           ` Eli Zaretskii
2022-06-30 17:22                                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-30 18:35                                                               ` Eli Zaretskii
2022-06-30 19:56                                                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-01  4:42                                                                   ` Gerd Möllmann
2022-07-01  6:04                                                                     ` Eli Zaretskii
2022-07-01  8:49                                                                       ` Gerd Möllmann
2022-07-01 10:31                                                                         ` Eli Zaretskii
2022-07-01 11:04                                                                           ` Gerd Möllmann
2022-07-01 11:12                                                                             ` Eli Zaretskii
2022-07-01 11:33                                                                               ` Gerd Möllmann
2022-07-01 11:44                                                                       ` Gerd Möllmann
2022-07-01 12:35                                                                         ` Gerd Möllmann
2022-07-01 12:56                                                                           ` Eli Zaretskii
2022-07-01 12:39                                                                         ` Eli Zaretskii
2022-07-01  5:27                                                                   ` Eli Zaretskii
2022-07-01 12:14                                                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-01 12:51                                                                       ` Eli Zaretskii
2022-07-01 14:38                                                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-01 15:43                                                                           ` Eli Zaretskii
2022-06-14 12:00                                   ` Lars Ingebrigtsen
2022-06-14 13:00                                     ` Eli Zaretskii
2022-06-09 10:25         ` Lars Ingebrigtsen
2022-06-09 10:40           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-09 10:41           ` Eli Zaretskii
2022-06-09 10:48             ` Lars Ingebrigtsen
2022-06-09 13:06               ` Eli Zaretskii
     [not found] <165605725704.24125.17210424600068379407@vcs2.savannah.gnu.org>
     [not found] ` <20220624075417.BFA82C0169C@vcs2.savannah.gnu.org>
     [not found]   ` <87wnd6v34k.fsf@gnus.org>
     [not found]     ` <83mte2coqg.fsf@gnu.org>
     [not found]       ` <87fsjuqpzi.fsf@gnus.org>
     [not found]         ` <83k096clsx.fsf@gnu.org>
     [not found]           ` <8735fup5oh.fsf@gnus.org>
     [not found]             ` <83a6a2cher.fsf@gnu.org>
     [not found]               ` <874k09nau4.fsf@gnus.org>
2022-06-25  7:17                 ` Eli Zaretskii
2022-06-25 10:10                   ` Lars Ingebrigtsen
2022-06-25 11:21                     ` Eli Zaretskii

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=837d57gbed.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=45898@debbugs.gnu.org \
    --cc=Emacs-hacker2018@jovi.net \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=psainty@orcon.net.nz \
    /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).