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: locked narrowing Date: Thu, 01 Dec 2022 18:48:26 -0500 Message-ID: References: <97049541-f5b4-ed3b-b8de-7c0bdc86f0f5@yandex.ru> <6e305c9b-7702-133a-3347-f64db05ade3f@yandex.ru> <83mt89kt10.fsf@gnu.org> <834juglesn.fsf@gnu.org> <83r0xkjw5s.fsf@gnu.org> <83pmd3ioxx.fsf@gnu.org> <47153506021498df087c@heytings.org> <83bkomhlmn.fsf@gnu.org> <4715350602cf2ec6860b@heytings.org> <83a646hkat.fsf@gnu.org> <47153506028bbb3bc8b3@heytings.org> <47153506021115866615@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="34450"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 56682@debbugs.gnu.org, Eli Zaretskii , dgutov@yandex.ru To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 02 00:49:25 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 1p0tIy-0008jN-Ql for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Dec 2022 00:49:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0tIe-000144-JL; Thu, 01 Dec 2022 18:49: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 1p0tIc-00013b-AG for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 18:49:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0tIc-0002Ox-19 for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 18:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0tIb-0003O6-Mh for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 18:49:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Dec 2022 23:49:01 +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.166993852013015 (code B ref 56682); Thu, 01 Dec 2022 23:49:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 1 Dec 2022 23:48:40 +0000 Original-Received: from localhost ([127.0.0.1]:42678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0tIF-0003Nr-NE for submit@debbugs.gnu.org; Thu, 01 Dec 2022 18:48:39 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0tIA-0003Nk-O5 for 56682@debbugs.gnu.org; Thu, 01 Dec 2022 18:48:38 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 846C5442670; Thu, 1 Dec 2022 18:48:28 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2A15C442611; Thu, 1 Dec 2022 18:48:27 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1669938507; bh=AOsRPh2e+VwVO4nxR5sZutdjHMRE5E4oyyZ6ecU5Lkg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Goi0ciYcl5uJTjRY6e9zMG2AuiJrfIiiyPox3q1g+Vy6NIGvfgzvA2/O3mYJARguC WwDDO+YQWk67+QbLa0mICQ6H6SXxsSoi9svOXFeQJisHDfU899m9LdtW3tnk1YBCr6 w7eliZEgW6GzMbNiAiZgMvPnW1DIOTMSdhTieHmpIu3KzVKebX9f87hCJwKHwYpuAF gBPv/VI/mzvUGvy9B3ITGm2QaHVkLGhtzgBAnDDAGXMEPXNXUSh256Rpj/+mcWH3JI ypFbmdrEtaPIIDMtcXibsdU/JmzqpB46oY5Nf6NyOswJg2UwEoQrwOqjtj7D4DZFJV zpOXevc+TJbiA== Original-Received: from pastel (unknown [45.72.193.52]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F26A5120516; Thu, 1 Dec 2022 18:48:26 -0500 (EST) In-Reply-To: <47153506021115866615@heytings.org> (Gregory Heytings's message of "Thu, 01 Dec 2022 23:11:09 +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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249680 Archived-At: Maybe another option is to do the scan more lazily, keeping track more precisely of what was scanned and/or needs rescanning. Do an initial scan on the whole buffer and after that keep a BEG..END limit approximating the region that has been modified since the last scan. As long as END - BEG < LINE_LENGTH_THRESHOLD - MAX_SEEN_LINE_LENGTH then we know we don't need to rescan anything at all. And when we do need to rescan we can limit the scan to BEG - MAX_SEEN_LINE_LENGTH ... END + MAX_SEEN_LINE_LENGTH I assume here that we would remember the MAX_SEEN_LINE_LENGTH. Stefan