From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Overlays as an AA-tree Date: Fri, 03 Feb 2017 11:13:43 +0200 Message-ID: <8360krvdq0.fsf@gnu.org> References: <87d1jylv43.fsf@fastmail.com> <87fujv64mn.fsf@hochschule-trier.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1486113288 22733 195.159.176.226 (3 Feb 2017 09:14:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Feb 2017 09:14:48 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andreas Politz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 03 10:14:43 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZZx4-0005j1-Gu for ged-emacs-devel@m.gmane.org; Fri, 03 Feb 2017 10:14:42 +0100 Original-Received: from localhost ([::1]:32789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZZx9-0003RU-TL for ged-emacs-devel@m.gmane.org; Fri, 03 Feb 2017 04:14:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZZwN-0003Ot-V3 for emacs-devel@gnu.org; Fri, 03 Feb 2017 04:14:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZZwJ-0001w8-Ui for emacs-devel@gnu.org; Fri, 03 Feb 2017 04:13:59 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZZwJ-0001w2-Qr; Fri, 03 Feb 2017 04:13:55 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2915 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cZZwJ-0001ny-22; Fri, 03 Feb 2017 04:13:55 -0500 In-reply-to: <87fujv64mn.fsf@hochschule-trier.de> (message from Andreas Politz on Fri, 03 Feb 2017 09:49:20 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211919 Archived-At: > From: Andreas Politz > Date: Fri, 03 Feb 2017 09:49:20 +0100 > > Hi, I'm interested in this problem as well. Thanks for working on this. > Overlays have begin B and end E positions each with a flag (front-advance > resp. rear-advance). These positions may change in one of 3 ways: > > 1. move-overlay is called > 2. Text of length L is inserted at position P. > Here the flags decide whether begin B resp. end E will move or not > in the literal border-cases P = B resp. P = E . > 3. Text of length L is deleted beginning at position P. > > Is this the correct model ? Not sure what you are asking here. You actually described the model of modifying buffer text, which is only tangentially related to overlays. > Someone mentioned in a different thread, > that occasionally we may have B > E. How does this happen ? I don't think it can happen, except during internal operations of inserting and deleting buffer text. The functions that handle these changes in buffer text fix up B and E such that B >= E before they return to the main loop, so Lisp will never see that. But note that you could have B == E (so-called "empty" or "zero-length" overlays). In this case, front-advance and rear-advance are applied to the same buffer position. There are also overlays that evaporate.