all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: divya@subvertising.org, 74281@debbugs.gnu.org
Subject: bug#74281: 30.0.91; font-lock mode hangs on scrolling large Scheme file
Date: Sun, 29 Dec 2024 15:01:49 -0500	[thread overview]
Message-ID: <jwved1q8e66.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86v7v2pb8o.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 29 Dec 2024 20:58:31 +0200")

>> diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
>> index a0f922f279c..c46422b7218 100644
>> --- a/lisp/progmodes/scheme.el
>> +++ b/lisp/progmodes/scheme.el
>> @@ -201,7 +201,10 @@ scheme-mode-variables
>>             scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
>>            nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
>>            beginning-of-defun
>> -          (font-lock-mark-block-function . mark-defun)))
>> +          (font-lock-mark-block-function . mark-defun)
>> +          ;; The (?#. "w 14") above causes font-lock to incorrectly
>> +          ;; set `font-lock--syntax-table-affects-ppss' to t.
>> +          (font-lock--syntax-table-affects-ppss . nil)))
>>    (setq-local prettify-symbols-alist lisp-prettify-symbols-alist)
>>    (setq-local lisp-doc-string-elt-property 'scheme-doc-string-elt))
>
> What does it do,

This variable controls whether font-lock uses `syntax-ppss` or not.
By setting to nil, it lets font-lock use `syntax-ppss` which means that
on large buffers it tends to be much faster because it doesn't need to
`parse-partial-sexp` all the way from `point-min` every time.

> and what potential harm could happen if we install this?

If it's set incorrectly, it can lead to messed up `syntax-ppss` state
(because some calls use one syntax table and others use another) which
could lead to mis-indentation, mis-fontification, incorrect highlighting
of matched paren, incorrect buffer navigation, etc...
Of course, these risks are confined to those buffers that use
`scheme-mode` or a mode that derives from it.

I believe the setting is correct for `scheme-mode`, but it's possible
that some derived mode changes the `font-lock-syntax-table` and relies
(incorrectly) on `scheme-mode` having already set
`font-lock--syntax-table-affects-ppss` to t.

This said, AFAICT this performance problem has been with us since
Emacs-28 (commit cdadb7a97cbe), so it's not super urgent to fix it.
I think we're fine with the fix on `master`.  It would be nice
to get confirmation from Divya that it does fix the problem he sees.


        Stefan






  reply	other threads:[~2024-12-29 20:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-09 16:04 bug#74281: 30.0.91; font-lock mode hangs on scrolling large Scheme file Divya Ranjan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14  8:44 ` Eli Zaretskii
2024-11-14  9:32   ` Divya Ranjan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 10:06     ` Eli Zaretskii
2024-11-14 11:09       ` Divya Ranjan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 11:42         ` Eli Zaretskii
2024-11-14 16:56   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30  9:51     ` Eli Zaretskii
2024-12-14  9:34       ` Eli Zaretskii
2024-12-28 11:09         ` Eli Zaretskii
2024-12-29 18:38           ` Divya Ranjan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-28 15:03       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-28 16:33         ` Eli Zaretskii
2024-12-29 15:20           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-29 18:01             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-29 18:58               ` Eli Zaretskii
2024-12-29 20:01                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-30 12:47                   ` Eli Zaretskii
2024-12-29 18:43             ` Divya Ranjan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-30  4:45               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-30  5:35                 ` Divya Ranjan via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-30 21:06                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-02 14:12                     ` divya--- via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

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

  git send-email \
    --in-reply-to=jwved1q8e66.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74281@debbugs.gnu.org \
    --cc=divya@subvertising.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.