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.devel Subject: Re: locked narrowing in ELisp Date: Wed, 17 Aug 2022 17:20:02 +0300 Message-ID: <83mtc3c5pp.fsf@gnu.org> References: <2d4a8d8f-d17d-6f84-cd45-586db2f9728c@yandex.ru> <79484704-f981-5c12-e000-333b75499520@yandex.ru> <8816ba91-3c71-c04b-32fd-122047795421@yandex.ru> <83pmgzc6ut.fsf@gnu.org> <3c4f3c87-39a1-9ee7-1ca7-384315882663@yandex.ru> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39047"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 17 16:21:51 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oOJvb-000A0b-1Y for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Aug 2022 16:21:51 +0200 Original-Received: from localhost ([::1]:54064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOJvZ-00044W-Pa for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Aug 2022 10:21:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOJuH-00022d-9y for emacs-devel@gnu.org; Wed, 17 Aug 2022 10:20:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOJuC-0001oz-Hw; Wed, 17 Aug 2022 10:20:26 -0400 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=wnxHPGfG/KVQgl25VSR33NEI+MayO27cT4nu5dw7Ak8=; b=PsBFH0OBmwuX MVZha2adIIDb8jozGTYskaKriV0wEjGDcQhnUo2wOSVO9VR528CAfz87mNEiGj16gOTQbntUNNSWN rvpAR+ePLtMV3KKAWOqV9k1Pp6+lkdz6pLuOyQAK5kBv8m72wqaWJrAGQ5JvXaaKgoU7+F+/dXVVh 7A8uCrvkDXulF4zOJfjTGc/eGgjGQ7WkDC5XPZuX/839mD5Y6SOF3p6BCFjCqeHKJbx6QD+Pco/jC Ya89TpYbfyjcdosbev4IDJmzfXYf5oGcYQCEFVxC0+wEenG8+yLl6VhI8QJ01IMdseI7tednrqUBP ihYZ9xB76E3KjjaN6tieSA==; Original-Received: from [87.69.77.57] (port=2405 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 1oOJu0-0008Lh-N1; Wed, 17 Aug 2022 10:20:24 -0400 In-Reply-To: <3c4f3c87-39a1-9ee7-1ca7-384315882663@yandex.ru> (message from Dmitry Gutov on Wed, 17 Aug 2022 17:03:46 +0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:293563 Archived-At: > Date: Wed, 17 Aug 2022 17:03:46 +0300 > Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > From: Dmitry Gutov > > On 17.08.2022 16:55, Eli Zaretskii wrote: > >> For instance, use two overlays in the current buffer with `invisible' > >> property rather than have the display engine refer to the new kind of > >> narrowing bounds. > > > > That's a time bomb waiting to go off, because invisible text is > > handled at a relatively high level in the display engine, and > > otherwise the invisible property is largely ignored in Emacs. > > User-level features should be implementable in terms of primitives > allowed in Lisp userland. I don't see how this is relevant to the concern I raised. I was talking about the effects on the display engine. It doesn't only display, it also looks at buffer text for various purposes. > > Moreover, it will make redisplay slower. Skipping invisible text is > > faster than iterating through it, but it still takes time, whereas not > > going beyond BEGV..ZV is instantaneous. > > Org, as one example, uses invisible text all the time. Other feature too. And Org is indeed relatively slow when you move through a buffer which has large parts of it hidden by invisible properties. > > And finally, I don't think I see the benefit of this, even if it'd > > work: you want to get rid of (save-restriction (widen)), but you are > > willing to have to replace that with tests of overlays and invisible > > text all over the place? > > No, I don't think the addition of "tests ... all over the place" will be > needed. The display engine handles the 'invisible' property already. > > A number of features/commands will indeed need to know the bounds of the > user-level narrowing (and we'll have a buffer-local variable for that), > but that's probably it. I don't think you realize how widespread is use of low-level primitives and functions in user-level commands. What you suggest is not a clean design, because it is based on inaccurate mental model of Emacs internals. It cannot work reliably, to the best of my knowledge.