GNU Emacs

26.9 MixedCase Words

Some programming styles make use of mixed-case (or “CamelCase”) symbols like ‘ unReadableSymbol’. (In the GNU project, we recommend using underscores to separate words within an identifier, rather than using case distinctions.) Emacs has various features to make it easier to deal with such symbols.

Glasses mode is a buffer-local minor mode that makes it easier to read such symbols, by altering how they are displayed. By default, it displays extra underscores between each lower-case letter and the following capital letter. This does not alter the buffer text, only how it is displayed.

To toggle Glasses mode, type M-x glasses-mode (see Minor Modes). When Glasses mode is enabled, the minor mode indicator ‘ o^o’ appears in the mode line. For more information about Glasses mode, type C-h P glasses RET.

Subword mode is another buffer-local minor mode. In subword mode, Emacs’s word commands recognize upper case letters in ‘ StudlyCapsIdentifiers’ as word boundaries. When Subword mode is enabled, the minor mode indicator ‘ ,’ appears in the mode line. See also the similar superword-mode (see Other Features Useful for Editing Programs).