[ESS] polymode, tangentially related to ESS

Phillip Lord phillip.lord at newcastle.ac.uk
Thu Mar 13 17:37:08 CET 2014

chris warth <cwarth at fhcrc.org> writes:
> I'm asking a polymode question here because it is tangentially related
> to ESS, and there are lots of emacs experts here.   My question is
> sincere and might come off as criticism, but that is not how it is
> meant.   I don't know what is possible in elisp so I'm asking the
> experts.
> I have been using vitoshka's polymode for editing R inside markdown
> documents.   The fact that it works at all is amazing, but it is not
> as fluid and seamless as one would want.
> Is this the best that we can hope to do in Emacs?   Using indirect
> buffers is kind of genius in a twisted kind of way, but also has
> inherent problems.    Can we ever hope to have a true multi-mode
> editor experience in a single buffer in Emacs?

The problem with indirect-buffers is that they share text-properties as
well as text. And modes use text-properties to do things. In my hands,
indirect-buffers in different modes end up fighting each other.

The second problem with this approach to multi-mode editing is that
*all* the tools must support the mixed syntax environment. 

Finally, I would say, it's not clear that you want the multi-mode
environment all the time; if you are writing a literate programme do you
want the buffer to be in two modes at once? Or do you want to have two
modes you can switch between -- so that when, for instance, you are
editing the documentation the code is visually less immediate and vice

Although it's not a replacement for polymode, I've been working on
"linked-buffers" which provides perhaps provides a solution. Unlike an
indirect-buffer the two linked-buffers have a relationship, but that
relationship is defined in lisp.

So, in this video we do something that *looks* like indirect-buffers,
but isn't (we share identical text although not text-properties).


In this video, I do something you cannot do with indirect-buffers -- the
two buffers have different text, yet you can update either.


Very, very alpha -- I am just playing to see if it works at the moment,
but so far the answer is that it does.


More information about the ESS-help mailing list