[ESS] tip for navigating camelCase

Erik Iverson eriki at ccbr.umn.edu
Fri Nov 5 19:04:55 CET 2010


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

Thought this might be possibly useful to others.


More information about the ESS-help mailing list