From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How is text properties stored? Date: Thu, 09 May 2019 16:40:40 -0400 Message-ID: References: <25202F5C-FE09-49D9-8782-5E9D013E0262@gmail.com> <934D9111-CDF3-4076-8F1D-2EC85276B098@gmail.com> <83ftpogp6k.fsf@gnu.org> <5EA156D7-EF8A-42C1-AEB2-4A97ADCE74CF@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="182991"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 09 22:41:30 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOpr8-000lRf-KI for ged-emacs-devel@m.gmane.org; Thu, 09 May 2019 22:41:30 +0200 Original-Received: from localhost ([127.0.0.1]:60716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOpr7-0003OV-MY for ged-emacs-devel@m.gmane.org; Thu, 09 May 2019 16:41:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOpqV-0003MM-Rq for emacs-devel@gnu.org; Thu, 09 May 2019 16:40:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOpqV-0000Ma-0x for emacs-devel@gnu.org; Thu, 09 May 2019 16:40:51 -0400 Original-Received: from [195.159.176.226] (port=59262 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hOpqU-0000Ks-Qm for emacs-devel@gnu.org; Thu, 09 May 2019 16:40:50 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hOpqQ-000kYe-H2 for emacs-devel@gnu.org; Thu, 09 May 2019 22:40:46 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:6DQYtaCSRedAAAHiE9OG/GkUl6s= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 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:236346 Archived-At: >> No, positions of intervals are continuously maintained as side effect >> of editing commands that change buffer text. > > > I still don't understand how is position maintained when user inserts > something. Say I insert some characters in interval (3), I know > total_length of (2) and (4) are updated. But how are the positions of > all the intervals after (3) -- (4), (5) and (6) updated? I don't see > relevant code in adjust_intervals_for_insertion. They're not updated at that moment. They'll be updated when you "move" to those other intervals: find_interval and next_interval presume that the current interval has correct `position` info and (re)compute the destination's `position` based on that info (and on the total_length of the relevant intervals along the way). Stefan