Next: Other Commands, Previous: Hungry Deletion of Whitespace, Up: Commands [Contents][Index]
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:
Nomenclature | Subwords |
——————————————————— | |
‘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 |
—————————————————————————- | ||
M-f | forward-word | c-forward-subword |
M-b | backward-word | c-backward-subword |
M-@ | mark-word | c-mark-subword |
M-d | kill-word | c-kill-subword |
M-DEL | backward-kill-word | c-backward-kill-subword |
M-t | transpose-words | c-transpose-subwords |
M-c | capitalize-word | c-capitalize-subword |
M-u | upcase-word | c-upcase-subword |
M-l | downcase-word | c-downcase-subword |
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.
Next: Other Commands, Previous: Hungry Deletion of Whitespace, Up: Commands [Contents][Index]