In python mode, when I forward-word
. The cursor jumps from H
to d
(Hello_World). But in another mode(shell-mode
or
Things got a little simpler since Emacs 24.4. There's now a M-x superword-mode
that has the desired effect.
I think you're looking for this:
(modify-syntax-entry ?_ "w")
Underscores will be treated as part of a word. This command will change the syntax table of the mode you're currently in. AFAIK there's no way to change syntax globally. However, you could try modifying the standard syntax table. Most major modes inherit the standard-syntax-table.
(modify-syntax-entry ?_ "w" standard-syntax-table)
If that doesn't work, I guess you have to add mode-hooks for all modes you're using and modify their syntax tables individually.