emacs-devel
[Top][All Lists]
Advanced

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

Re: Question collaborative editing.


From: Ergus
Subject: Re: Question collaborative editing.
Date: Wed, 30 Sep 2020 15:19:31 +0200

On Wed, Sep 30, 2020 at 02:40:26AM -0500, Karl Fogel wrote:
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

This is interesting indeed.

I was looking at this to compare what's around:

https://ecc-comp.blogspot.com/2015/05/a-brief-glance-at-how-5-text-editors.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]