From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeff Norden Newsgroups: gmane.emacs.devel Subject: Re: A question about overlays and performance. Date: Thu, 30 Jul 2020 13:21:45 -0500 Message-ID: References: <87pn8f3x5m.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9829"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 30 20:23:13 2020 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 1k1DCy-0002JM-SW for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Jul 2020 20:23:12 +0200 Original-Received: from localhost ([::1]:54276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k1DCx-0003xv-V4 for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Jul 2020 14:23:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1DBj-0003HT-P9 for emacs-devel@gnu.org; Thu, 30 Jul 2020 14:21:55 -0400 Original-Received: from mta.tntech.edu ([149.149.2.87]:52895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1DBe-0002fb-2f for emacs-devel@gnu.org; Thu, 30 Jul 2020 14:21:55 -0400 Original-Received: from math.tntech.edu (unknown [149.149.102.6]) by mta.tntech.edu (Postfix) with ESMTPS id 9DF7F300006C; Thu, 30 Jul 2020 13:21:47 -0500 (CDT) Original-Received: from norden.tntech.edu ([149.149.102.4] helo=norden.math.tntech.edu) by math.tntech.edu with esmtp (Exim 4.92) (envelope-from ) id 1k1DBZ-0004AO-Du; Thu, 30 Jul 2020 13:21:45 -0500 Original-Received: by norden.math.tntech.edu (Postfix, from userid 742) id 5D64E2572B73; Thu, 30 Jul 2020 13:21:45 -0500 (CDT) In-Reply-To: <87pn8f3x5m.fsf@localhost> (message from Ihor Radchenko on Wed, 29 Jul 2020 09:52:37 +0800) X-SA-Spam-Score: 0.0 X-SA-Spam-Report: Spam detection software, running on the system "math.tntech.edu", has NOT identified this incoming email as spam. If you have any questions, contact @@CONTACT_ADDRESS@@ pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_HELO_TEMPERROR SPF: test of HELO record failed (temperror) Received-SPF: pass client-ip=149.149.2.87; envelope-from=jnorden@tntech.edu; helo=mta.tntech.edu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/30 14:21:47 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:253353 Archived-At: >> ... inclined to agree with Stefan's opinion about indirect buffers. > Another common use is narrowing to subtrees, so that you have two > buffers with different narrowing for the same org file. It is not > possible within a single buffer, as far I as know. So the org case for indirect buffers is messier than I had imagined, which shouldn't surprise me. I'm a very casual user of org - just as an alternative to outline-mode for the cycling and the intuitive use of the tab key. > What do you mean by "exactly the opposite"? I was working on changing some text-property based code to use overlays instead, but I'm having second thoughts. Overlays simplified some things, but not as much as I thought they would. I also ran into a couple of snags: 1) There don't seem to be 'char-property' versions of text-property-any or text-property-not-all. I guess you could do this in lisp with a loop using next-char-property-change, but that works against my original goal of simplifying things. 2) A simple option that you have for protecting hidden text when using text-properties is to temporarily mark it as read-only, e.g.: (add-text-properties beg end '(invisible t read-only t)) Of course, you need to make sure you remove both properties when you un-hide (and take into account that you are now changing read-only text). It also means that you can't kill or delete a region that contains hidden text without un-hiding it first. That may or may not be a good thing, depending on your perspective. There might also be other side-effects that I'm not thinking of right now. --- I just looked at org a bit more and discovered org-catch-invisible-edits. It works, in part, because org re-binds the keys that usually call delete-char and delete-backward-char. I tried it, and found that even with catch-invisible-edits set to 'error, if you put the cursor right before an ellipsis and type M-d, the first word in the hidden text is silently deleted. I wouldn't say this is a bug or problem, since it is hard to imagine someone doing that accidentally. I just thought it was interesting. Best regards, -Jeff