emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question collaborative editing.


From: Karl Fogel
Subject: Re: Question collaborative editing.
Date: Wed, 30 Sep 2020 02:40:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]