From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56682: locked narrowing Date: Thu, 01 Dec 2022 23:43:22 +0200 Message-ID: <83a646hkat.fsf@gnu.org> References: <83k076dd7d.fsf@gnu.org> <83czcyd8jf.fsf@gnu.org> <83a682d66r.fsf@gnu.org> <837d36ceno.fsf@gnu.org> <37dd2827f54f8bbda5e3@heytings.org> <735c1d5b-0d64-a8e1-3aaa-91fc0248abd3@yandex.ru> <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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17066"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, monnier@iro.umontreal.ca, dgutov@yandex.ru To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 01 22:44:23 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 1p0rLz-0004FR-0y for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Dec 2022 22:44:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0rLh-0007R1-9U; Thu, 01 Dec 2022 16:44:05 -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 1p0rLf-0007Qk-3u for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 16:44:03 -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 1p0rLe-0004y3-NP for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 16:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0rLe-00028i-IL for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2022 16:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Dec 2022 21:44: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.16699310378211 (code B ref 56682); Thu, 01 Dec 2022 21:44:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 1 Dec 2022 21:43:57 +0000 Original-Received: from localhost ([127.0.0.1]:42115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0rLZ-00028N-6O for submit@debbugs.gnu.org; Thu, 01 Dec 2022 16:43:57 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0rLX-00028F-Kb for 56682@debbugs.gnu.org; Thu, 01 Dec 2022 16:43:56 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0rLR-0004uc-Gf; Thu, 01 Dec 2022 16:43:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Iyna3xzK1cNBgRrNh2K9sFdWtDSTdPYdQ5Bmnah1G74=; b=nn6TtgWdWr9j DaH6Kcf9kGu70+BoNtCU20T78FIYHseMD2y1hsG7HNd7e+gB7CNrfcqxOTvG0PEH3/gA63cPN3XL3 GTyuajFuq7JMtOR+8F5dV5wbX9QK3uw9xxcUMxshgBORTtT8VtDTaJ+1peF8tuFYBJNQWaQIf1Xy/ jCG6ikD4/L9BULc4EjL0jv7o3kNxU2TbdskgjPEu3UPEIG5ON21y/dnZBKiHOKDS5cEJ5Bk7Hc/rg 6Ek3zCU5bX4wvmlxrrkZTbhCI0Ge+4ilqHgd9h6OjT5E0pbtaAnr/5BTrWkJNlCi1w44pN8HUdZCq mRf2Qwmr3/qbdHj0j1bW9g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0rLQ-0003Xk-W4; Thu, 01 Dec 2022 16:43:49 -0500 In-Reply-To: <4715350602cf2ec6860b@heytings.org> (message from Gregory Heytings on Thu, 01 Dec 2022 21:36:03 +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:249675 Archived-At: > Date: Thu, 01 Dec 2022 21:36:03 +0000 > From: Gregory Heytings > cc: 56682@debbugs.gnu.org, monnier@iro.umontreal.ca, dgutov@yandex.ru > > > >> 1. M-: (let ((large-file-warning-threshold nil)) (find-file "dictionary.json") (narrow-to-region 4000000 4004000)) RET > >> 2. C-x n w > >> 3. Kaboom! > > > > By "Kaboom!" you mean what? a crash? Because it doesn't crash here. > > This is a build from the latest emacs-29 branch. > > > > I mean that Emacs is trapped in the long line problem again, don't you see > it? No, not in particular. Maybe you use a different file? But anyway, what exactly does this prove, and how? I asked why we need to look beyond the narrowing, so how does the above answer that question? what am I missing? > > This is all beyond argument. We do want the heuristic. I just want it > > to be cheaper than it is now, especially for buffers without any long > > lines, where each time we run this loop we waste CPU cycles. So I'm > > looking for ways of wasting less of them. > > There are none, or at least none that I can see. Your proposed heuristic > to limit the scan to some portion of the buffer around point cannot work, > precisely because the loop is not called during each redisplay cycle, but > only from time to time. See the example above. Again, we cannot know > what happened in the buffer between these two moments, which could be far > away in time. We can either use a heuristic on the whole buffer, or not > use a heuristic and scan only a portion of the buffer. We cannot combine > both, and use a heuristic on a portion of the buffer. It would simply be > too unsafe. I give up. I will probably try to find time to code this myself, since you don't even want to try.