[ESS] font-lock behaviour

Martin Maechler maechler at stat.math.ethz.ch
Mon Aug 20 11:20:17 CEST 2007


>>>>> "DD" == Dan Davison <davison at stats.ox.ac.uk>
>>>>>     on Sat, 18 Aug 2007 15:11:37 +0100 writes:

    DD> With ess 5.3.5 in (.R and *R* buffers), there's a minor
    DD> difference in the font-lock behaviour which has a
    DD> slightly undesirable consequence: briefly, whereas
    DD> previously (5.3.4) the two characters `' were considered
    DD> as a pair of opening and closing quotes and thus marked
    DD> some characters as a string, the ' no longer seems to
    DD> close the quote opened by `. I'm not putting forward an
    DD> opinion as to whether that's appropriate or not, but one
    DD> example of it having slightly annoying consequences is
    DD> the following: if you create a shared library from
    DD> within R with a command like system("R CMD SHLIB tmp.c")

    DD> then you get output in the *R* buffer like

    DD> make: `tmp.so' is up to date.

    DD> which leaves the font-lock thinking that you're in the
    DD> middle of a string, my most elegant solution to which is

    DD> ` <ctrl-c> <ctrl-c>

    DD> to get correct font-lock back... So if possible, perhaps
    DD> `' should be allowed as a opening-closing pair?

If one could do this easily for *output* only, and given the
following, we probably would.

Note that the change in ESS has been very much intentional :
R's NEWS file for R version 1.8.0 (Oct 2003 !) has had

-------------------------------------------------

    CHANGES TO THE LANGUAGE

	o   .................

	o   .................

	o	Non-syntactic variable names can now be specified by inclusion
	    between backticks `Like This`.	The deparse() code has been
	    changed to output non-syntactical names with this convention,
	    when they occur as operands in expressions.  This is controlled
	    by a `backtick' argument, which is by default TRUE for
	    composite expressions and FALSE for single symbols.  This
	    should give minimal interference with existing code.

-------------------------------------------------

and consequently, for four years now (if you work with the prerelease
"R-devel" as I do),  `name`  has been wrongly fontified in ESS.

Hence it seems overdue to make `...`  correctly behave as a
quoting pair  rather than      `...'

I agree that it  sometimes is a pain if you get such `...' in
*R* output  and ideally we'd find a way to prevent the font-lock
misbehavior in such situation.
I'm not an expert in Emacs' Syntax setup (which really is the
basic ingredient to font-lock behavior), but maybe someone else ?

    DD> While I'm making trivial complaints about such nice and
    DD> sophisticated software, one more question: the following
    DD> code is evaluated at start-up by the default ess
    DD> installation, but is there any way to prevent it
    DD> printing to screen?

    >> if(!exists("baseenv", mode="function")) baseenv <-
    >> function() NULL options(STERM='iESS',
    >> editor='emacsclient')

I'm sure there is,
  use  'fortune(109)' in R after having installed and loaded the
  fortunes package
  >>> This is R. There is no if. Only how. 

but am less sure if it's worth it  ;-)
Martin

    DD> Thanks a lot,

    DD> Dan

    >> version
    DD>                _ platform i686-redhat-linux-gnu arch
    DD> i686 os linux-gnu system i686, linux-gnu status major 2
    DD> minor 5.1 year 2007 month 06 day 27 svn rev 42083
    DD> language R version.string R version 2.5.1 (2007-06-27)




More information about the ESS-help mailing list