Hi Berthold, thanks for the report.
>>>>> Berthold Lorke <[email protected]> writes:
> Okay, I am sorry if I am bugging you (no pun intended), but I now
> still do believe there is a problem.
> I am using auctex 13.1.9. Let us assume the following inside of a
> buffer in `tex-mode` with auctex installed. I did this with a fresh
> Emacs, no other packages installed and no config.
I assume AUCTeX latex mode, not `tex-mode`.
> - Mark the region where I wrote `a^2 + b^2 = c^2`, that is line 7.
> - Perform `M-x LaTeX-environment`, put `equation` in the prompt, press
> enter, and then for the next prompt press enter again.
[...]
> As you can see, it is not correctly indented. Have tried this
> multiple times on multiple machines and so on. Can you confirm this
> behaviour?
Indeed. This is't nice. :-(
Currenty, `LaTeX-insert-environment' doesn't indent the active region if
the environment is in `LaTeX-indent-environment-list'. I expect that it
doesn't harm if it indents. Could you try the attached patch?
Bye,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
diff --git a/latex.el b/latex.el
index 56992d54..85d83f38 100644
--- a/latex.el
+++ b/latex.el
@@ -821,12 +821,12 @@ 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.
+ (LaTeX-fill-region content-start (line-beginning-position 2))
+ ;; Else just indent the region. (bug#48518)
+ (indent-region content-start (line-beginning-position 2)))
(set-mark content-start))
(indent-according-to-mode))
;; Indent \end{foo}.
@@ -1335,7 +1335,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)))
_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex