[ESS] tip for navigating camelCase

Rodney Sparapani rsparapa at mcw.edu
Fri Nov 5 22:32:08 CET 2010


On 11/ 5/10 01:04 PM, Erik Iverson wrote:
> Hello,
>
> Just wanted to point out 2 minor-modes I discovered
> today that help when navigating source files written
> with camelCase variables.
>
> First, there is glasses-mode, which recognizes
> camelCase names and optionally
>
> i) inserts a separator of your choice (e.g., _)
> between successive words
>
> ii) makes the capital letters in the name a
> different face (e.g., bold).
>
> *Note that the buffer is not actually changed,
> the characters are inserted using overlays.*
>
> To get these, customize the variables
> glasses-face and glasses-separator. There are
> other glasses-* variables that may be of interest, too.
> I set my glasses-separator to "", but use bold for the
> face so that the capital letters stick out a bit more.
>
> The second minor-mode has to do with navigation,
> not display. It is included in Emacs 23.2 as
> subword-mode and will cause M-f and M-b to treat
> camelCase identifiers as separate words, just as
> if they had been separated with a '.' or '_'. I believe
> this was called c-subword-mode in previous versions of
> emacs, but have not tested that.
>
> I have both of these modes set for R-mode file via
> hooks.
>
> Thought this might be possibly useful to others.
>
> --Erik
>

I was trying to figure out why Erik posted this since I thought
he was talking about the camel language which, I think, is a
descendant of Lisp.  But, it's not about that (and it's spelled
caml by the way).  What he is talking about is camel case AKA
Pascal case and possibly other names.  Camel case is popular
in certain languages like Pascal or certain programming paradigms
like OS/2 and Windows.  It just means that capital letters
appear in the interior of words like PostScript, QuickTime,
RealPlayer, etc.  It gave me an idea.  Maybe eSs or EsS is
better than ESS :o)

Rodney



More information about the ESS-help mailing list