I generally prefer AucTeX over the built-in tex-mode, but one thing that is much better in tex-mode is navigation by s-expression. Namely, in tex-mode, forward-sexp
(C-M-f
) treats LaTeX environments as s-expressions; with the point right before \begin{foo}
, forward-sexp
will take you to after the corresponding \end{foo}
. Other sexp based functions also do the right thing, for example backward-up-list
(C-M-u
) will take you to the enclosing \begin{foo}
.
How can I get this functionality in AucTeX?
(I noticed tex-mode defines a latex-forward-sexp
and sets forward-sexp-function
to that function. I tried loading tex-mode after AucTeX and evaluating (setq-local latex-forward-sexp #'latex-forward-sexy)
but that didn't seem to change the behavior of forward-sexp
in the AucTeX buffer.)