I'm using auctex, and trying to make underscores count as part of a word. There are numerous answers to this question, and I've tried the following

(modify-syntax-entry ?_ "w")
(modify-syntax-entry ?_ "w" latex-mode-syntax-table)
(modify-syntax-entry ?_ "w" LaTeX-mode-syntax-table)
(modify-syntax-entry ?_ "w" tex-mode-syntax-table)
(modify-syntax-entry ?_ "w" TeX-mode-syntax-table)

this works for any other mode, but not for my auctex files. I'm not even sure which is the correct syntax table (for example C-h m tells me that I'm in LaTeX/FMP mode, but there is no syntax table called LaTeX/FMP). Any ideas how to proceed?

Using emacs 25.1.1, auctex version 11.90.0.

  • What about (add-hook 'TeX-mode-hook (lambda () (modify-syntax-entry ?_ "w"))) ?
    – Name
    Feb 2, 2018 at 15:36
  • @Name I actually manually ran all of the above examples, after everything had already loaded, and it had no effect. Which I assume means that there is something within auctex that interferes with the way underscores are usually handled...
    – funklute
    Feb 2, 2018 at 15:45
  • Have you tried one of the other "numerous answers to this question"? E.g. using superword-mode?
    – Stefan
    Feb 2, 2018 at 16:17
  • I don't know if the solution given in emacs.stackexchange.com/a/9584 can help.
    – Name
    Feb 2, 2018 at 16:19
  • @Stefan I had in fact not come across superword-mode, if you want to post this as an answer I will accept it; it seems to be doing pretty much exactly what I want.
    – funklute
    Feb 2, 2018 at 16:24


Browse other questions tagged or ask your own question.