I'd like Emacs to treat this


as one word. So I evaluated this line

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

to have Emacs treat dollar sign as a word constituent rather than a symbol. However, when I run forward-word from the beginning of the line below, it stops at the dollar sign when I'd like it to stop at the "n" instead.


How can I define dollar sign as a word constituent and have forward-word ignore it just like when it sees alphabet?

  • Maybe you already have it configured correctly, and your problem is the behavior of forward-word. Place your cursor immediately before the dollar sign, and type C-u C-x = and see what it says about the syntax of the character $. In fundamental-mode, for example, the default syntax is already set to: syntax: w which means: word – lawlist Jun 30 '16 at 15:21
  • It says "$ w which means: word". – stacko Jun 30 '16 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.