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#56682: Fix the long lines font locking related slowdowns Date: Sun, 31 Jul 2022 03:25:46 -0400 Message-ID: References: <837d46mjen.fsf@gnu.org> <8a3eaeef01be5bfaa5ef@heytings.org> <05388e8d8812bfa3695d@heytings.org> <83v8rf5894.fsf@gnu.org> <65cb7c73fd4a999cca00@heytings.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="16414"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56682@debbugs.gnu.org, Eli Zaretskii To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 31 09:27:21 2022 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 1oI3M8-000462-Ri for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 09:27:21 +0200 Original-Received: from localhost ([::1]:52560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oI3M7-0003bf-RI for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jul 2022 03:27:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oI3Lq-0003ZQ-Vh for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 03:27:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oI3Lq-0007pf-NB for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 03:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oI3Lq-0004id-HR for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2022 03:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jul 2022 07:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.165925237718085 (code B ref 56682); Sun, 31 Jul 2022 07:27:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 31 Jul 2022 07:26:17 +0000 Original-Received: from localhost ([127.0.0.1]:36319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI3L2-0004hW-W0 for submit@debbugs.gnu.org; Sun, 31 Jul 2022 03:26:16 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oI3Kw-0004gx-IX for 56682@debbugs.gnu.org; Sun, 31 Jul 2022 03:26:11 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A1396440600; Sun, 31 Jul 2022 03:26:00 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7FA50440202; Sun, 31 Jul 2022 03:25:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1659252359; bh=Yh7LdCBv21u0lkeGaHZF9G3X0EVv0ddkTaMABJkM2sU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Ze2dm4Zk7IulWvsxoloBZgXw7jjq5Xgi4Dvjodr6poAoRvMTD5asdCErz6S6hLQeZ MUMpx/VL7PUWRotBSBm77hHtKfy+lKLgV2+U6hVSFJ5JgMdIJghouj028vHN1gkqo4 McvU4wROMQ0TVE5bbN9ghFW/xH2JYgC3a8U/DwrLQMEd3toIJItTmsnq5qEntMvVOU U7iq/GVcHgDFZlVXrzimRoQlw+Jpc86wXftLbbA1o7/8gZ7DdLVBPCDgUZZnKX6XVy 1R64goKY04sOqvfvq+1eYMe6xNHaRtBAnzpzMf71FSf1A11+ZaV7gNXYyi3H/byow4 WqvLAaELk76mA== Original-Received: from milanesa (dyn.144-85-173-218.dsl.vtx.ch [144.85.173.218]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6358B1202E6; Sun, 31 Jul 2022 03:25:58 -0400 (EDT) In-Reply-To: <65cb7c73fd4a999cca00@heytings.org> (Gregory Heytings's message of "Sat, 30 Jul 2022 10:52:48 +0000") 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" Xref: news.gmane.io gmane.emacs.bugs:238318 Archived-At: > IIUC, what Stefan suggests is the following, which seems (almost) fine to > me. The only problem I see is that jit-lock-function is not the only user > of fontication-functions. It has at least two other users: in ELPA > multi-mode.el sets fontification-functions to multi-fontify, and in MELPA > poly-lock.el sets fontification-functions to poly-lock-function. Good point. > @@ -4412,9 +4412,9 @@ handle_fontified_prop (struct it *it) > ptrdiff_t begv = it->narrowed_begv ? it->narrowed_begv : BEGV; > ptrdiff_t zv = it->narrowed_zv; > ptrdiff_t charpos = IT_CHARPOS (*it); > if (begv <= charpos && charpos <= zv) > - Fnarrow_to_region (make_fixnum (begv), make_fixnum (zv), Qt); > + specbind (Qfontification_functions_restriction, > + Fcons (make_fixnum (begv), make_fixnum (zv))); > } Hpw 'bout we do the reverse then: set the narrowing, but let-bind a variable to indicate that we're inside a line-length-induced narrowing, together with the previous narrowing bounds, so jit-lock or its clients can undo the narrowing when needed? Stefan