From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.devel Subject: Re: Overlays as an AA-tree Date: Tue, 07 Feb 2017 13:35:39 +0100 Message-ID: <878tpiqiuc.fsf@hochschule-trier.de> References: <87d1jylv43.fsf@fastmail.com> <87fujv64mn.fsf@hochschule-trier.de> <87fujvpkzc.fsf@fastmail.com> <87vasr5tqd.fsf@hochschule-trier.de> <87d1ex4kon.fsf@hochschule-trier.de> <87d1evod6x.fsf@fastmail.com> <877f53ftab.fsf@hochschule-trier.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486470970 19292 195.159.176.226 (7 Feb 2017 12:36:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2017 12:36:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: Joakim Jalap Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 07 13:36:03 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 1cb503-0004bb-P9 for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2017 13:35:59 +0100 Original-Received: from localhost ([::1]:53534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb509-0003uC-8Y for ged-emacs-devel@m.gmane.org; Tue, 07 Feb 2017 07:36:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cb503-0003u5-Cu for emacs-devel@gnu.org; Tue, 07 Feb 2017 07:36:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cb500-00026Y-6j for emacs-devel@gnu.org; Tue, 07 Feb 2017 07:35:59 -0500 Original-Received: from gateway-a.fh-trier.de ([143.93.54.181]:38703) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cb4zz-00025f-Sm for emacs-devel@gnu.org; Tue, 07 Feb 2017 07:35:56 -0500 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier (RZ/HT)] Original-Received: from localhost (ip5f5bdee7.dynamic.kabel-deutschland.de [95.91.222.231]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id D7189179A375; Tue, 7 Feb 2017 13:35:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1486470940; bh=xN+kKUot8IUJMJPw2zcHxGJ4b+I=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=T0XCf5kf9F0je8+LJ7Nyu5Zoc1yyP0yUlt239K0CD9/GWRLErMfBZBsm9aTdpBGCM Py7FZbAFbLYfNhs0TBK3Cjx2ttDGrnzdRYSOuGYUIKya5FBPo1zWUH7M5c34dpEUUR dUVMuw2w7RS2iOEIW1piDarVPoftRYMkCmLk9S1c= In-Reply-To: <877f53ftab.fsf@hochschule-trier.de> (Andreas Politz's message of "Mon, 06 Feb 2017 12:33:16 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 143.93.54.181 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:212084 Archived-At: Andreas Politz writes: > I think its safe (in a RB-Tree anyway, AA probably as well) to remove > the root node of the tree, given, that all other nodes are sorted. Well, this assumption was a little bit short-sighted, since deleting a node may restructure the tree in way which changes this ancestor relationship. I thought about adding the front-advance property into the key-function, but that just moves the problem to the deletion stage. What I ended up doing was removing all nodes with front-advance set and starting at the insert position before doing the normal operation on the other nodes, and then reinserting the front-advance ones with incremented begin (according to length of the "inserted text"). -ap