There are a number of commands in Emacs which apply to "words." Examples include forward-word
, kill-word
, upcase-word
, mark-word
, transpose-words
, etc. The definition of "word" seems to vary a bit between the commands. For example, forward-word
will stop at an underscore within a word (e.g. foo_bar
) but mark-word
does not stop at the underscore.
Is it possible to change the definition of "word" when I am in a prog mode so that Emacs will use the appropriate word boundaries for the syntax of the current language?
When I am in c-mode
I want forward-word
to skip over underscores, and when I am in lisp-mode
I want forward-word
to skip over both hyphens and underscores, etc.