[ESS] Font locking in *R* {was "ESS usage poll"}

Emanuel Heitlinger emanuelheitlinger at gmail.com
Fri Jun 11 10:00:15 CEST 2010


At Fri, 11 Jun 2010 09:40:06 +0200,
Martin Maechler wrote:
> 
> >>>>> "EH" == Emanuel Heitlinger <emanuelheitlinger at googlemail.com>
> >>>>>     on Thu, 10 Jun 2010 18:06:58 +0200 writes:
> 
> [........]
> 
>     EH> At Thu, 10 Jun 2010 22:36:17 +1200, Patrick Connolly wrote:
> 
>     >> > 4. If you could only request one feature, what would it be?
>     >> 
>     >> A clever way of dealing with the unbalanced quotes (to
>     >> R's way of thinking) that can be returned to Emacs from a
>     >> bash call.  The ` character screws up the font colouring.
>     >> Can't imagine how it could be done, and I realize it's
>     >> really a bash issue, but I'd be very grateful if someone
>     >> could work out a way of dealing with it.  I invariably
>     >> see colours as though it's all a string irrespective of
>     >> function names or anything else.  I tire of deleting the
>     >> offending character before I can read R code properly.
>     >> I'm very lazy, I know.
>     >> 
>     >> HTH
> 
>     EH> I second that: This font coloring screw up is the only issue I am
>     EH> having at the moment. I was never able to investigate it
>     EH> further, as Patrick did.
> 
> As Deepayan Sarkar said  in his reply, the problem here is a
> bigger issue, namely that we have font locking (aka "font coloring")
> in the *R* (and *.Rout) buffers, the same as in the *.R ones.
> 
> Font locking of `...` as a string is clearly necessary, because
> of what it means in R; please learn about it if you need.
> 
> However, I agree that it's painful if some R packages
> ("mgcv", "lasso2", notably) produce noise on loading and that
> noise uses old-style  `quoted text'  (backward-quote text forward-quote),
> because there you have an opening backquote but no closing one.
> 
> BTW, the current workaround is very fast, once you're used to
> it: 
>  " C-r ` C-d "  (search backwards for backquote, and delete it)
>    ---------
> {{I can still sympathize with Patrick who's tired of doing that :-)}}
> 
> 
> The question is really what we should do.
> 
> I do like the font locking of *input* typed in *R* buffers,
> including the coloring reminding me that I need a closing quote.
> What Deepayan (and I) really would like is to have the 
> input font-locked but all the "console" output remain untouched
> (maybe even getting a slightly dimmed color scheme).

I vote for this! If output would not be touched it would also avoid
the case of a backlsash being evluated. Resulting in 
Error: unexpected input in "\" 
which could of course be cured even more easily by evaluating just 
anoter \

Emanuel



More information about the ESS-help mailing list