[ESS] polymode, tangentially related to ESS

Phillip Lord phillip.lord at newcastle.ac.uk
Mon Mar 17 15:46:57 CET 2014


Vitalie Spinu <spinuvit at gmail.com> writes:

>  >>>  (Phillip Lord)on Fri, 14 Mar 2014 11:17:47 +0000 wrote:
>
> [...]
>  > 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
>  > properties.
>
> Font lock operates on narrowed region all the time. And region is
> narrowed to the chunk. I also syntactically comment everything before
> the chunk. This improves C-like modes which disregard a lot of newer
> emacs conventions like font-lock-dont-widen.

Okay, that makes sense.

>
>  > 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.
>
> Can you share text properties per region? That is in latex block use
> properties from latex-mode in *all* the buffers? If so that might be
> interesting, but it comes very closely to what I have done with indirect
> buffers then.

Well, the only thing linked-buffer does is *use* two functions -- one
which replicates changes into other linked-buffers, and one which
translates a buffer position into one into a position in another (they
can be different because the content is not identical).

So, you could use copy properties over in anyway that you choose,
including filtering them by region. But my code does not do this at the
moment.


> Polymode is not hardwired with indirect buffers. If your
> "linked-buffers" allow a better alternative, I would be happy to modify
> polymode to use linked-buffers instead.
>
> [...]
>
>  > I've written a long post describing this, which will go live as soon as
>  > I've kicked people to kick the webserver!
>
> Looking forward to that. 

It's up now!

http://www.russet.org.uk/blog/2979



>  > 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. 
>
> I thought #_() is a block comment.  Is there a standard syntax for
> clojure literate programming?


#_ or (comment (stuff)) comments out the next form, but the form still
#has to be syntactically valid. Consider....

user> (comment (hello))
nil
user> (comment [hello))
RuntimeException Unmatched delimiter: )  clojure.lang.Util.runtimeException (Util.java:219)
RuntimeException Unmatched delimiter: )  clojure.lang.Util.runtimeException (Util.java:219)
user> #_(hello)
user> #_[hello]
user> #_[hello)
RuntimeException Unmatched delimiter: )  clojure.lang.Util.runtimeException (Util.java:219)


>  > 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.
>
> Markdown works well with polymode. It works for lisp. It works with
> clojure-mode also, not so much with cider for evaluation. That should be
> fixable. I am interested in developing for clojure and I would be happy
> to add support for clojure literate programming and inline
> documentation.


That would be good. In genuinely do not know which approach is best (and
least effort), so trying out both would be good.

Phil



More information about the ESS-help mailing list