From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: Question collaborative editing. Date: Wed, 30 Sep 2020 02:40:26 -0500 Message-ID: <87r1qjzp91.fsf@red-bean.com> References: <20200925002239.fgg3vw2nylltcoyp@Ergus> <219042AC-556D-48CC-8920-82D9BF2BD3AA@aol.com> <3A81FB67-A558-4281-8285-CDD9B01033E3@posteo.net> <1C949FC9-6023-467E-99EC-75D57B08AFB0@gnu.support> <20200929124513.fd745r2txowwbiir@Ergus> <87blho7af9.fsf@red-bean.com> <20200929215849.zg4wzytbrwx2b7ih@Ergus> <84B86B7C-81F0-42DF-894C-BF577E4B3D6E@mit.edu> <20200930001333.g6b3mqa4mdsoxiue@Ergus> Reply-To: Karl Fogel Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21607"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Qiantan Hong , Fermin , Jean Louis , Noam Postavsky , Emacs developers , Stefan Monnier To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 30 09:41:43 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 1kNWkB-0005Vb-2b for ged-emacs-devel@m.gmane-mx.org; Wed, 30 Sep 2020 09:41:43 +0200 Original-Received: from localhost ([::1]:58202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNWkA-0003JI-5v for ged-emacs-devel@m.gmane-mx.org; Wed, 30 Sep 2020 03:41:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNWjA-0002eC-Ce for emacs-devel@gnu.org; Wed, 30 Sep 2020 03:40:40 -0400 Original-Received: from newsp.red-bean.com ([45.79.25.59]:44694 helo=sanpietro.red-bean.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNWj7-0003vk-L6 for emacs-devel@gnu.org; Wed, 30 Sep 2020 03:40:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=red-bean.com; s=202005newsp; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:Reply-To:References:Subject:Cc:To:From:Sender: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9DKjvu0iu2pYWEK06gTSEypRjWRWhQ4Nz81grQT4vsE=; t=1601451635; x=1602661235; b=b75Gvub1ZLiQZPpdGeVhFmassd9C98WiQU5ADrx7W606wOMkVa2oC3cglzgAUoN7FhB7qFSkiN tAIpYMPtWTJGhsuOs+1Uaq7cziXqxZjDFiv0TTgQQD+dEMUl163oNTdtnsaKNghi9D1F6IAIltJIn 81UsVbKxSyXfHSiPqKtpZfYeJTqxEwIYHOUY1MB+pKVYVLcxVpYOpqJqkz4zirsqiHktNF9BRZsh2 feTWtfIqT2YJ/GgRNc8EnEtlbt+8XdaVH6E8LRldlq22dyrUmF5QlYnzLH4/il2l6g/tphVlggYfx FSllq9vS2Ef2oF6Lzt5rxFNpnCuPapQJLtPPA==; Original-Received: from 99-112-125-163.lightspeed.cicril.sbcglobal.net ([99.112.125.163]:36278 helo=floss) by sanpietro.red-bean.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNWix-0001KE-RG; Wed, 30 Sep 2020 07:40:27 +0000 In-Reply-To: <20200930001333.g6b3mqa4mdsoxiue@Ergus> (Ergus's message of "Wed, 30 Sep 2020 02:13:33 +0200") Received-SPF: pass client-ip=45.79.25.59; envelope-from=kfogel@red-bean.com; helo=sanpietro.red-bean.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/30 03:40:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-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:256743 Archived-At: On 30 Sep 2020, Ergus wrote: >I would be concerned about the performance (but I am paranoid about >Emacs performance anyway so don't worry for that). AFAIR emacs buffers >are stored in a contiguous way (I may be wrong) Information about how Emacs buffers are represented under the hood can be found here: * https://git.savannah.gnu.org/cgit/emacs.git/tree/src/buffer.h#n213 * https://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-Gap.html TL;DR: It's a contiguous array with a gap at the point where insertion or deletion happens. When you need to insert or delete somewhere else, Emacs first moves the gap to the new location. The gap is exposed to Elisp via the functions `gap-position' and `gap-size', though I must confess I've never used them from Elisp. Best regards, -Karl