Superword- and Subword-Mode in Emacs 24.4

If you like—or are forced to use—camelCaseWords, Emacs has subword-mode that will cause word-based cursor movements to stop at each of the individual words. This can sometimes be useful when you repeatedly need to move to one of the constituent words of a series of compound words.

I rarely have a need to edit camel case words so I never need subword-mode but often have a related problem. In Emacs, when the cursor is in front (or behind) of compound-word or compound_word, moving by word will stop at each constituent word. That’s seldom what you want. You’d like to jump over the whole thing because you’re normally thinking of it as a single word.

As Xah Lee tells us, Emacs 24.4 will have superword-mode that will treat things like compound-word as a single word. That will be handy for programmers who often deal with compound-words or other_compound_words. Lee’s post has the details but notice how the two modes achieve a unification: with subword-mode you always move by word constituents; with superword-mode you always move by the entire compound word, no matter how it’s formed. That’s why the two modes are mutually exclusive.

This entry was posted in General and tagged . Bookmark the permalink.