From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: A question about overlays and performance. Date: Wed, 29 Jul 2020 09:52:37 +0800 Message-ID: <87pn8f3x5m.fsf@localhost> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39899"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eliz@gnu.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Jeff Norden Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 29 03:53:58 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 1k0bI6-000AE1-Ik for ged-emacs-devel@m.gmane-mx.org; Wed, 29 Jul 2020 03:53:58 +0200 Original-Received: from localhost ([::1]:32846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0bI5-0000Ec-Gx for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Jul 2020 21:53:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0bHW-0008G8-BQ for emacs-devel@gnu.org; Tue, 28 Jul 2020 21:53:22 -0400 Original-Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:50739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0bHU-0001N7-HH; Tue, 28 Jul 2020 21:53:22 -0400 Original-Received: by mail-pj1-x1036.google.com with SMTP id k71so1100506pje.0; Tue, 28 Jul 2020 18:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=Oo32FOG/2ThWAYaocmisAozDzVff6jM+F/g+l2GuX7Q=; b=EeFoEXvYuNQKg0KpGdyvuIIzO1J1x2NHI2/gtldyKJjsZ9Dfob1oj6nZxNI/ZfSCwW +n2cAwQ+Lyf8DOR74xduDocu8MwV4W4gAfavBAQPffhd9h4fkHrR/yx2JyPDa79VlGTm SkG711wQLJ/bMASjt98vaD7mnvifGopL1/1NjJ8Gr958Kkw5yYNjli0ntWRTDEFBDVgF ZwJrK3GjDrbLd/CdBJveG9eBcMb6Xtcc0jMrxQ5or7PiqSNzeZzc9n5Kz+1pdj1sslVT vacAUuAMDOaNkgc/iokYT3sz9gKzWm7T4wP0F63Ws4v/Hqk3cZ0J2usWBZhbQZnD9Gxu SnvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=Oo32FOG/2ThWAYaocmisAozDzVff6jM+F/g+l2GuX7Q=; b=j7twFIE8gQAp/JQRaByGgX3ogUi5MtgS/CPCwTQp6JT2fnTaN//V3BMqGcxwWJHCUb 0vfmNTjZT8gdKOaqgLkeC7a/g2bpuktWO5oUbgNWKdQhACo+HEerILDnBxrvGm4NNTnY FT70jMs4ieMYcFx/F236q7t/Iimwhszeuv38gbV677OVARpNPQenQUfkourpAgbYYeFo qY9FFrm4ekUHD5kLKJeBTI9Cpg7/I++Iol9tbOEls7S2RxHfhJxvKIsURoWr1Nx17ZHB ag5JORvIeq+lUcij3pqWH8X74clt5LHhYG8DiB7J6HzgoIniPiVGqSyPbsV7jLDtnEaG Ya8w== X-Gm-Message-State: AOAM531NXY8+5z159p4ANzxknY0FMbCIga9ojZ3HxxfI9AuVOXG5vova bNyCKZBWbmHPaoPSaeFmXVU= X-Google-Smtp-Source: ABdhPJyJVFiHzeTGPJLgYxNq3lWHY84UO4Lu/D8d3T+Em45+gZ8ZSSP+DQRjW/twar1QnQbhv8BLag== X-Received: by 2002:a17:902:8e87:: with SMTP id bg7mr25331804plb.19.1595987598460; Tue, 28 Jul 2020 18:53:18 -0700 (PDT) Original-Received: from localhost ([101.99.64.65]) by smtp.gmail.com with ESMTPSA id t25sm318707pfl.198.2020.07.28.18.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 18:53:17 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1036.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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:253322 Archived-At: > It's interesting that you are working to change org's overlays back to > text properties, while I'm considering doing exactly the opposite for > the project that I've been playing with. Org is using overlays to fold anything right now, same as outline-mode. What do you mean by "exactly the opposite"? If you need some specific feature that is lacking in text properties, but present in overlays, let me know here or jump into the patch discussion: https://www.mail-archive.com/emacs-orgmode@gnu.org/msg127740.html > Do org buffers routinely wind up with thousands of overlays? It is very common when you have an org file with thousands of headlines each containing a [folded] property drawer. I provided an example org file in the patch discussion: https://www.mail-archive.com/emacs-orgmode@gnu.org/msg127740.html > From what little I've seen of them, I'm quite inclined to agree with > Stefan's opinion about indirect buffers. Is their main use in org to > provide multiple views of a buffer with different foldings? 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. > I wonder if it might be possible to implement a "window-invisibility-spec", > that would override the buffer-spec when set. It would have to be done > in C, not lisp. You might even want to add a new field in the window > structure. I have no real clue as to whether this is possible, feasible, > or a good idea. But it might provide a nice way to display a single buffer > in two different windows with different levels of hidden text. It seems > like it would be a lot simpler than using indirect buffers, but I'm > certainly no expert on this. I do not think that it is a good idea for this spefic case. If I understand correctly, the only advantage of such approach would the fact that you do not need to create an indirect buffer. However, there is a problem with "window-local" approach. Anything that is "window-local" implies that it can affect **any** buffer shown in that window. So, we will need to handle buffer changes without adding any extra benefit in comparison with indirect buffer approach. Not to mention, that the ability to have independent narrow states will be lost. Best, Ihor Jeff Norden writes: >> I am currently working on re-implementing org-mode folding from using >> overlays to text-properties. > > It's interesting that you are working to change org's overlays back to > text properties, while I'm considering doing exactly the opposite for > the project that I've been playing with. Do org buffers routinely wind > up with thousands of overlays? > >> Stefan Monnier writes: >>> ... >>> And the way I recommend to avoid this problem is to stay clear of >>> indirect buffers (which I consider as an attractive nuisance). > > From what little I've seen of them, I'm quite inclined to agree with > Stefan's opinion about indirect buffers. Is their main use in org to > provide multiple views of a buffer with different foldings? > > I wonder if it might be possible to implement a "window-invisibility-spec", > that would override the buffer-spec when set. It would have to be done > in C, not lisp. You might even want to add a new field in the window > structure. I have no real clue as to whether this is possible, feasible, > or a good idea. But it might provide a nice way to display a single buffer > in two different windows with different levels of hidden text. It seems > like it would be a lot simpler than using indirect buffers, but I'm > certainly no expert on this. > > Regards, > -Jeff -- Ihor Radchenko, PhD, Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg