[R-gui] NEdit Highligth patterns for R

A.J. Rossini rossini@u.washington.edu
11 Oct 2002 07:02:02 -0700


>>>>> "ernesto" == Ernesto Jardim <ernesto@ipimar.pt> writes:


    ernesto> On Fri, 2002-10-11 at 09:00, Philippe Grosjean wrote:

    >> 1) It would be interesting to highlight in different colors functions and
    >> arguments... but they can have same name. Example: plot(x, col=2) -argument
    >> 'col' and col(x), function 'col'. For the moment, the only easy way I found
    >> is to define argument followed by = in the dictionnary, like 'col=' for the
    >> argument. However, space is allowed between 'col' and '=', and then the
    >> argument is not correctly coloured. So, I add an automatic correction that
    >> eliminates spaces before a single '=' sign. But now that '=' is also allowed
    >> as asignment, it is problematic: col = 1, with 'col' being the name of a
    >> variable (indeed, col <- 1) is now highlighted as an argument.

Look back through the ancient discussion (i.e. 1992 or so) on
font-locking with Emacs.  There are many good arguments against
turning your editor into "fruit-salad" (hence (X)Emacs provides
options for controling level of coloration/fontification variation). 

    >> 2) Of course, one could statically define the dictionnary with, let's say,
    >> all functions and arguments in the base and recommended packages. I would
    >> prefer a dynamic construction of the dictionnary: when a library is loaded,
    >> terms are added, when it is unloaded, they are eliminated. This is only
    >> possible with a bidirectionnal communication between the editor and the R
    >> calculation kernel. I got this in SciViews but how to do that in Nedit or
    >> other separate script editors?

ESS has been doing this forever, and I'm sure any modern editor with
extensibly scripting in a decent language can or already does this as
well (vim, alpha, etc...).

best,
-tony

-- 
A.J. Rossini				Rsrch. Asst. Prof. of Biostatistics
U. of Washington Biostatistics		rossini@u.washington.edu	
FHCRC/SCHARP/HIV Vaccine Trials Net	rossini@scharp.org
-------------- http://software.biostat.washington.edu/ ----------------
FHCRC: M: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email
UW:   Th: 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX
(my tuesday/wednesday/friday locations are completely unpredictable.)