Using forward-word with this line:

foo *** *** bar,

I want to have the folowing behavior:

foo| ***| ***| bar|,


foo| *** *** bar|,

So, if between spaces there are only non-letter symbols, let's consider this a word too. forward-whitespace is not good enough, cause it loses distinction between letters and non-letters at all. How this can be done?

1 Answer 1


Just use forward-sexp instead (bound to C-M-f). Likewise, backward-sexp (C-M-b).

See (elisp) List Motion.

If you don't want to do that then you'll need to change the syntax for character * in your buffer to be word syntax:

(modify-syntax-entry ?* "w")

Or for a given syntax table, my-table:

(modify-syntax-entry ?* "w" my-table)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.