emacs-devel
[Top][All Lists]
Advanced

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

Re: Indirect buffers


From: Phillip Lord
Subject: Re: Indirect buffers
Date: Mon, 09 Jun 2014 11:49:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Eli Zaretskii <address@hidden> writes:
> So I suggest to step back a notch, and try looking for ideas to
> implement these features in a way that doesn't require different
> buffers to share text.  E.g., even manually keeping several separate
> buffers in sync by updating their text when it changes in one of them,
> sounds like an easier way.  Emacs is very good at inserting and
> deleting chunks of text into/from a buffer, and from what I've read,
> all the major problems Vitalie complained about will be miraculously
> solved.  It should be easy to implement a prototype in Lisp, and if it
> turns out it is too slow (which I sincerely doubt), we could add some
> simple infrastructure in C to speed that up.


Forgive the plug, but this is exactly how my own linked-buffer works.

https://github.com/phillord/linked-buffer/

It works fine and is performant enough for smallish files; I haven't
tried it for much larger ones yet. This is with a very dumb
implementation (the whole buffer is copied on the after change hook).

The big advantage over indirect buffers is that I control the way in
which text in the two buffers is related; if this is `buffer-string'
you'd get the same as indirect-buffers (although less efficiently). If
you use the no-properties version, then you get something like
indirect-buffers but multi-modes work. If you use an function which
changes the text, then you can support two modes with incompatible
syntaxes. No support at all is needed from the modes.

Phil



reply via email to

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