In spite of the GNU Coding Standards, it is popular to name a symbol by mixing uppercase and lowercase letters, e.g., ‘GtkWidget’, ‘EmacsFrameClass’, or ‘NSGraphicsContext’. Here we call these mixed case symbols nomenclatures. Also, each capitalized (or completely uppercase) part of a nomenclature is called a subword. Here are some examples:
|‘GtkWindow’||‘Gtk’ and ‘Window’|
|‘EmacsFrameClass’||‘Emacs’, ‘Frame’, and ‘Class’|
|‘NSGraphicsContext’||‘NS’, ‘Graphics’, and ‘Context’|
The subword minor mode replaces the basic word oriented movement and editing commands with variants that recognize subwords in a nomenclature and treat them as separate words:
|Key||Word oriented command||Subword oriented command|
Note that if you have changed the key bindings for the word oriented commands in your .emacs or a similar place, the keys you have configured are also used for the corresponding subword oriented commands.
Type C-c C-w to toggle subword mode on and off. To make the mode turn on automatically, put the following code in your .emacs:
(add-hook 'c-mode-common-hook (lambda () (subword-mode 1)))
As a bonus, you can also use
subword-mode in non-CC Mode
buffers by typing M-x subword-mode.