[ESS] polymode, tangentially related to ESS

Phillip Lord phillip.lord at newcastle.ac.uk
Fri Mar 14 12:17:47 CET 2014

Vitalie Spinu <spinuvit at gmail.com> writes:

>  >>>  (Phillip Lord)on Thu, 13 Mar 2014 16:37:08 +0000 wrote:
> [...]
>  > 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.
> Well, to some it is a problem to others it is a must have. Fontification
> is also implemented as text properties. As long as the modes "do their
> things" in their own buffers it is good enough.

Out of curiosity how do you stop this being a problem with polymode? In
my experience, if I have two indirect buffers in two different modes the
currently active one "wins" the syntax highlighting because of the text

With linked-buffers you could share some (or all, or none) of the text
properties, as you choose. By default I share text and no properties.

>  > The second problem with this approach to multi-mode editing is that
>  > *all* the tools must support the mixed syntax environment. 
> This is true for all multi-mode approaches out there, but much less so
> with indirect buffers.

When I say *all* the tools I mean all of them, including all the ones
not in Emacs. So the programming language and the documentation tool as

>  > 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
>  > versa.
> All multi-modes that don't use indirect buffer got the latter way. They
> switch the mode, which is notoriously slow and requires dealing with
> mode by mode basis with tons of workarounds. 

Yeah, I tried that as well and you say, it's a pain.

>  > In this video, I do something you cannot do with indirect-buffers -- the
>  > two buffers have different text, yet you can update either.
>  > https://vimeo.com/88658729
> This is cool, but what is the use of it, concretely? What exactly do you
> try to achieve in the long run?

I've written a long post describing this, which will go live as soon as
I've kicked people to kick the webserver!

I want to do literate programming. Or perhaps more accurately programmed
literature, as I expect in many cases there will be a lot more text than
program. The tool set I want to integrate (Clojure and Latex) does not
easily allow this combination, mostly because Clojure doesn't have block
comments, nor can they be coded in at a user level. So I have two
buffers which are *views* of the same information but not exactly the
same content.

I also want to get it working with Markdown -- I get really frustrated
that I cannot run the code snippets in my documentation; they are a pain
in the ass to maintain.

It's an experiment at the moment, though. I though about the various
multi-mode options and started to wonder whether it is the idea that is
wrong, rather than the implementation. The only way you find out is by


More information about the ESS-help mailing list