Subject: Re: bug#21434: BUG Report: "mark-sexp" function disable.

From: Tassilo Horn <[email-masked]>
Date: Fri, 11 Sep 2015 14:42:55 +0200

赵瑞昌 <[email-masked]> writes:

> I have updated the emacs to 24.5.1, and installed auctex 11.88.8 by
> `package-list-packages'.  however, the problem seems still exist: when
> `C-M-@' (mark-sexp) at the beginning of a `\begin{...', only `\begin'
> canbe marked, instead of the whole env.  And also the
> `forward/backward-sexp' can only effect to the `\begin'.

Ah, now I get what you are saying.  Well, (La)TeX has no real notion of
a sexp, so `forward-sexp' and `backward-sexp' basically move over words
and symbols (TeX macros), or from one (, [, or { to the respective
closing paren/bracket.

But you can give Magnar's awesome expand-region a try.

  https://github.com/magnars/expand-region.el

That has support for expanding the current region also in LaTeX specific
ways.  E.g. with

\begin{enumerate}
\item foo
\item _b_ar
\end{enumerate}

where the _b_ means point is on the b in bar, calling er/expand-region
results in

\begin{enumerate}
\item foo
\item _bar_
\end{enumerate}

where the complete _bar_ is marked, another call gives

\begin{enumerate}
\item foo
_\item bar_
\end{enumerate}

where the complete \item ... is marked, another two calls mark all
items, and a final call markes the complete environment.

I think that's exactly what you want, right?  And expand-region.el can
do this magic not only for latex but also for lisp, ruby, python, xml,
javascript, CSS, and what not.

Bye,
Tassilo