From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74281: 30.0.91; font-lock mode hangs on scrolling large Scheme file Date: Sun, 29 Dec 2024 15:01:49 -0500 Message-ID: References: <8734k0cs1u.fsf@subvertising.org> <86zfm2jjbo.fsf@gnu.org> <865xo59hhm.fsf@gnu.org> <86a5cfsr6a.fsf@gnu.org> <86v7v2pb8o.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9553"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: divya@subvertising.org, 74281@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 29 21:03:41 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tRzVk-0002Ju-J2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Dec 2024 21:03:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRzVA-0004ry-4b; Sun, 29 Dec 2024 15:03:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRzV8-0004ri-Hs for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 15:03:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRzV8-0005QO-8a for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 15:03:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=PeesF4WYoWtVk2e6D3MiWPz4jXFXd2OZcs7cq2ENjZk=; b=mCOW919ztniSmF6Rk6IpXf2CY8qE4P5TFcKQczod/CIJYoeDnW6b16k//H2xEp4D0OwZtqI55/H09TZv2eOGEhBh8ehgCiaTxVD90nFvh5AQXfjeZSYHmInOY+rIhyXZZbuM2lwWq5ip9t6ecxeLvsbi7D9XWqNnuwBxT6oenIAQisppBEICGSci7vZkQvXUomA/mlAvfMOufe0EjOpGqZgEAOjzb15kavbDAgbCbZorHEH20L+TOXQuv8G/0X+KaASGCzwIEnjIL18nhyMS7c4dzqs3x9l4O2iEfe3M6O34F8eGUkcz04l9+J9a0GyzsoRbXCcflbKlZ42TKRVBJw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRzV8-0002Hs-3F for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 15:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Dec 2024 20:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74281 X-GNU-PR-Package: emacs Original-Received: via spool by 74281-submit@debbugs.gnu.org id=B74281.17355025248714 (code B ref 74281); Sun, 29 Dec 2024 20:03:02 +0000 Original-Received: (at 74281) by debbugs.gnu.org; 29 Dec 2024 20:02:04 +0000 Original-Received: from localhost ([127.0.0.1]:56303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRzUC-0002GU-2s for submit@debbugs.gnu.org; Sun, 29 Dec 2024 15:02:04 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRzU9-0002Fm-K4 for 74281@debbugs.gnu.org; Sun, 29 Dec 2024 15:02:02 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E986180329; Sun, 29 Dec 2024 15:01:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1735502509; bh=AIggM/D9rW5/ObZdIn9LpOEPMmiMUnsRw03/DVeCaqY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QucGayWkKKyIguH3VOI4jKlc4J160BdLBhWpCTUExgAhGsU5MveWLdqrroGdJvpjK LSevIiGVEJpdV7y/Hh1Y/2XPgUCE7KCUFWKRphl/qO7bG1L4bCTGFiR8yC+yb860w9 zT1rvA4c16/wjq3GKrdwfszYgilP2jDzh2TqDdm7aeYaAFvtrLd8ISbXK9r6At/Qpa H5ma0ZPZcQuNq5sDctvSSwYbKqK17id0u3YxNf4nNlO1HvBUnffKruQ/PqlO7MMpwM mlluplvV2tvjJ48Pj+VprztpoQU5SWW5bhzoLGXd6oSxflVRymPIhWviVE5ia6LVd7 koJZ7omlmsosQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CB6968001E; Sun, 29 Dec 2024 15:01:49 -0500 (EST) Original-Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 99616120280; Sun, 29 Dec 2024 15:01:49 -0500 (EST) In-Reply-To: <86v7v2pb8o.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 29 Dec 2024 20:58:31 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297973 Archived-At: >> 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