In LaTeX-mode (AUCTeX) buffers, the backslash "\" is treated as an escape character. I'd like it to be treated as word constituent (syntax class "w") instead, but only in LaTeX-mode buffers. The main reason is that it's more convenient for moving and deleting word-wise (M-f etc), including macros with their backslashes.
Some answers to questions like Treat symbols as words in prog modes suggest to use "superword-mode", but that doesn't work for me because it changes the underscore syntax, which is not what I want. Others suggest to use
(modify-syntax-entry ?\\ "w")
(modify-syntax-entry ?\\ "w" ***-mode-syntax-table)
at appropriate places in the initialization file, where "***" is the current mode.
Unfortunately the first solution changes the backslash syntax globally The first solution is buffer-local, as @Stefan pointed out, and it works if inserted in the LaTeX-mode hook. But the second doesn't work if I replace "***" with "latex", "tex", "LaTeX", or "TeX".
Any idea why the second command above is not working in latex-mode buffers? Cheers!