Subject: bug#74281: 30.0.91; font-lock mode hangs on scrolling large Scheme file

From: Stefan Monnier <[email-masked]>
Date: Sun, 29 Dec 2024 13:01:14 -0500

>>> > Ping!  Divya, could you please try Stefan's suggestions and report
>>> > back?
>>> FWIW, I think the change is an improvement in any case, so we could
>>> install it.  Since it's in a "core" file, it might be too risky for
>>> `emacs-30`, so I'm thinking of installing it in `master`, WDYT?
>> Fine by me, thanks.
> Pushed to `master`, thanks.

BTW, if we want something on `emacs-30`, we could go with a patch like
the one below.

        Stefan

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