unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Indirect buffers
       [not found] <61933bd2-7a72-4666-bf23-deb677e1d62f@default>
@ 2014-06-08 16:39 ` Eli Zaretskii
  2014-06-09 10:49   ` Phillip Lord
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2014-06-08 16:39 UTC (permalink / raw)
  To: Drew Adams, Vitalie Spinu; +Cc: Stefan Monnier, emacs-devel

> Date: Sun, 8 Jun 2014 08:53:54 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> 
> [Beyond this, I hope you will revisit the behavior wrt jit-lock and
> indirect buffers, to DTRT following the (unfinished) emacs-devel thread
> "Re: trunk r116426: * lisp/jit-lock.el (jit-lock-mode): Keep it disabled
> in indirect buffers." (2014-05-21 to 2014-05-30).  Like Vitalie, I would
> like to see a solution to the problem of font-locking indirect buffers
> independently of each other and of the base buffer, each according to
> its major mode etc.]

And I wish you and Vitalie just dropped the idea.  It's unworkable.
It's against the very design of the Emacs display engine.  Stefan is
right: indirect buffers are an attractive nuisance.

By the time Vitalie or someone else solves the basic problems whose
discussion has just begun in that thread, we will discover that
problems pop up all over the place.  Just wait until people start
using multi-mode implemented via indirect buffers with all the arsenal
of display-related tricks and hacks that Emacs lets you play with.
IME, you cannot possibly envision most, let alone all, of the
complications that the existing display features impose on something
like that.

And we didn't even start talking about performance, of which this
implementation will surely be a killer, except in very small buffers.

Something that at first sight already looks as going against the
current design of redisplay is simply not worth the time.  For such
fundamental features, "almost works" is really another way of saying
"broken".  If it isn't clear how to make it work "perfectly" now,
before all the complications are known, you can be sure there will be
unsolvable problems once work will have begun in earnest.

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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Indirect buffers
  2014-06-08 16:39 ` Indirect buffers Eli Zaretskii
@ 2014-06-09 10:49   ` Phillip Lord
  2014-06-09 14:41     ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Phillip Lord @ 2014-06-09 10:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Vitalie Spinu, Stefan Monnier, Drew Adams, emacs-devel

Eli Zaretskii <eliz@gnu.org> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Indirect buffers
  2014-06-09 10:49   ` Phillip Lord
@ 2014-06-09 14:41     ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2014-06-09 14:41 UTC (permalink / raw)
  To: Phillip Lord; +Cc: spinuvit, monnier, drew.adams, emacs-devel

> From: phillip.lord@newcastle.ac.uk (Phillip Lord)
> Cc: Drew Adams <drew.adams@oracle.com>,  Vitalie Spinu <spinuvit@gmail.com>,  Stefan Monnier <monnier@iro.umontreal.ca>,  <emacs-devel@gnu.org>
> Date: Mon, 09 Jun 2014 11:49:05 +0100
> 
> 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.

Thanks for the pointer.  I indeed wondered how was it possible that no
one came up with such a simple idea, so now I'm happy I was wrong.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-09 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <61933bd2-7a72-4666-bf23-deb677e1d62f@default>
2014-06-08 16:39 ` Indirect buffers Eli Zaretskii
2014-06-09 10:49   ` Phillip Lord
2014-06-09 14:41     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).