branch: externals/auctex commit 5cf1dd2ae2cce3393481138fe57392aab14256ef Author: Ikumi Keita <ik...@ikumi.que.jp> Commit: Ikumi Keita <ik...@ikumi.que.jp>
Indent the active region (bug#48518, bug#28382) * latex.el (LaTeX-insert-environment): Indent the active region so that indentation isn't broken even in nested environments. (LaTeX-env-label): Remove indentation code no longer necessary by the above change. --- latex.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/latex.el b/latex.el index 56992d54fb..fb862b7637 100644 --- a/latex.el +++ b/latex.el @@ -821,12 +821,13 @@ environment just inserted, the buffer position just before (end-of-line 0) (if active-mark (progn - (or (assoc environment LaTeX-indent-environment-list) - (if auto-fill-function - ;; Fill the region only when `auto-fill-mode' is active. - (LaTeX-fill-region content-start (line-beginning-position 2)) - ;; Else just indent the region. (bug#48518) - (indent-region content-start (line-beginning-position 2)))) + (if (and auto-fill-function + (not (assoc environment LaTeX-indent-environment-list))) + ;; Fill the region only when `auto-fill-mode' is active + ;; and no special indent rule exists. + (LaTeX-fill-region content-start (line-beginning-position 2)) + ;; Else just indent the region. (bug#48518, bug#28382) + (indent-region content-start (line-beginning-position 2))) (set-mark content-start)) (indent-according-to-mode)) ;; Indent \end{foo}. @@ -1335,7 +1336,6 @@ Just like array and tabular." (LaTeX-newline) (indent-according-to-mode)) (when (TeX-active-mark) - (indent-region (point) (mark)) ;; Restore the positions of point and mark. (exchange-point-and-mark)))