[ESS] no color on functions that are R built in like "lm" or "mean"

Martin Maechler maechler at stat.math.ethz.ch
Wed Aug 8 20:03:37 CEST 2012


On Wed, Aug 8, 2012 at 1:07 PM, Vitalie Spinu <spinuvit at gmail.com> wrote:
>
> Hi Paul,
>
> I have been using personal tweaks to highlight functions for years. And
> I must definitely say that it's a nice thing, as it helps distinguish
> what is what.  As far as I know all other editors also highlight
> functions.

Yes, and I always found it awful.
Which of the 10000 functions of the base and recommended (and other CRAN ?)
packages should be highlighted and which not?
Also,  "{" and "(" and "+" and .... are all functions as well in R.
Honestly I've always found it distracting and a bit ridiculous when
I've occasionally seen other  editors do it....
...
but yes, it is a entirely a matter of taste (and what you are used to).

I think we should make this easily configurable, in a similar way that
"C-c ." allows to set the ESS indentation style, there should be a
simple way to choose
one of a few predefined fontification schemes  (and then, of course,
the user is free to choose her/his own colors for the
font-lock-<foo>-face
((in emacs: menu [Edit]
                      --> (at bottom)  [Text Properties]
                          --> (almost bottom)  [Display Faces]
))


> So I have just incorporated my font-lock tweaks into trunk. Feel free to
> check it out.
>
> Best,
> Vitalie.
>
>   >> Paul Johnson <pauljohn32 at gmail.com>
>   >> on Wed, 8 Aug 2012 00:13:51 -0500 wrote:
>
>   > Sorry, this got sent as I was re-organizing. Now I see it is better to
>   > just ask simply:
>
>   > What words are colorized in Emacs/ESS on your system? I just see a few...
>
>   > And:
>
>   > If you wanted to get color on functions like "lm" "mean" "sd" how
>   > would you do it?
>
>   > pj
>
>   > On Tue, Aug 7, 2012 at 11:55 PM, Paul Johnson <pauljohn32 at gmail.com> wrote:
>   >> I haven't thought about color-coding of kewords in Emacs/ESS in a long
>   >> time. A student pointed out something that seems different than I
>   >> remember.
>   >>
>   >> Didn't Emacs with font lock have coloring for common R functions like
>   >> c, rep, and so forth?
>   >>
>   >> Here are the colors I see now in Emacs ESS
>   >>
>   >> 1. A few functions are colorized.
>   >> The word "library" is in turquoise.  As far as I can tell, it is the
>   >> only function whose name is colorized.
>   >>
>   >>
>   >> 1. all comments in red
>   >>
>   >>
>   >> 3. The left hand side is blue when defining a function.. I mean, if I type
>   >>
>   >> purble <- function(xy){
>   >> mean(x)
>   >> }
>   >>
>   >> The word purple is purple and function is blue.
>   >>
>   >> 4. Strings--things in quotes, are purple.
>   >>
>   >> I still have the awful/frustrating behavior that a comment like
>   >>
>   >> ## I'm frustrated this does not work
>   >>
>   >> treats the part after the single quote as the beginning of a character
>   >> string and everything after the "'" turns purple, until another "'" is
>   >> found.
>   >>
>   >> But, I digress.
>   >>
>   >> In th old days, weren't there standard colors for common R functions
>   >> like lm, rep, and others?
>   >>
>   >> The students asked me to installl Notepad++ with NPPTOR on the lab
>   >> systems, along with some guy's "language coloring" syntax file.
>   >>
>   >>
>   >> But I remember the old days when the highlighting in Emacs/Ess was
>   >> more prolific. Am I just remembering it wrong?
>   >>
>   >> My system is Debian with:
>   >>
>   >> emacs                                        23.4+1-3
>   >> ess                                          12.04-4-1
>   >>
>   >> and the .emacs file has
>   >>
>   >> (global-font-lock-mode t) ; turn on syntax highlight
>   >>
>   >> and a lot of other crap in it:  If I am not seeing the colors you do
>   >> see, then it probably means I've loaded some crap that breaks
>   >> highlighting.
>   >>
>   >> (setq text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
>   >>
>   >>
>   >> pj
>   >>
>   >> --
>   >> Paul E. Johnson
>   >> Professor, Political Science    Assoc. Director
>   >> 1541 Lilac Lane, Room 504     Center for Research Methods
>   >> University of Kansas               University of Kansas
>   >> http://pj.freefaculty.org            http://quant.ku.edu
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>



More information about the ESS-help mailing list