2

I'd like to treat underscores (_) as word characters everywhere (prog-mode, text, comments, etc.). I'm currently doing so in specific modes, like this:

(add-hook ruby-mode-hook #'ivan-treat-underscore-as-word-char)
(defun ivan-treat-underscore-as-word-char () (modify-syntax-entry ?_ "w"))

But I'm not sure how to do the equivalent across the board. Even in ruby-mode, I find that underscores don't behave like word-characters inside strings.

1 Answer 1

3

If you want to do something in every mode then you can use after-change-major-mode-hook to run your code.

1
  • That did the trick, and solved a whole bunch of completion pain points I was having. Thank you!
    – ivan
    May 25, 2017 at 0:23

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.