[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex aabf144dfb 22/37: Arrange indent of tabular-like
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex aabf144dfb 22/37: Arrange indent of tabular-like environments (bug#65648) |
Date: |
Wed, 11 Oct 2023 03:41:56 -0400 (EDT) |
branch: externals/auctex
commit aabf144dfb5c2ce4a2de37f45d88b0fadf77a57a
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Arrange indent of tabular-like environments (bug#65648)
This fixes bug#54949 as well.
* latex.el (LaTeX-env-beginning-pos-indent): New function to align "&"
and \end{foo} relative to the indent of the line where \begin{foo} is,
not the column of \begin{foo} itself.
(LaTeX-indent-tabular, LaTeX-hanging-ampersand-position): Use the new
function instead of `LaTeX-env-beginning-pos-col'. This makes
difference when \begin{foo} isn't on its own dedicated line.
(LaTeX-hanging-ampersand-position): Arrange the doc string.
* tests/latex/tabular-out.tex: Modify the expected result according to
the above change.
---
latex.el | 24 +++++++++++++++++++-----
tests/latex/tabular-out.tex | 8 ++++----
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/latex.el b/latex.el
index 548b18a912..3abb00f216 100644
--- a/latex.el
+++ b/latex.el
@@ -8911,22 +8911,36 @@ function would return non-nil and `(match-string 1)'
would return
(replace-match "\\\\input{" nil nil)))))
(TeX-normal-mode nil))
+;; This function is no longer used; We leave it for compatibility.
(defun LaTeX-env-beginning-pos-col ()
"Return a cons: (POINT . COLUMN) for current environment's beginning."
(save-excursion
(LaTeX-find-matching-begin)
(cons (point) (current-column))))
+;; This makes difference from `LaTeX-env-beginning-pos-col' when
+;; something non-whitespace sits before the \begin{foo}. (bug#65648)
+(defun LaTeX-env-beginning-pos-indent ()
+ "Return a cons: (POINT . INDENT) for current environment's beginning.
+INDENT is the indent of the line containing POINT."
+ (save-excursion
+ ;; FIXME: There should be some fallback mechanism in case that the
+ ;; next `backward-up' fails. (Such fail can occur in document
+ ;; with temporarily broken structure due to in-progress editing
+ ;; process.)
+ (LaTeX-backward-up-environment)
+ (cons (point) (LaTeX-current-indentation))))
+
(defun LaTeX-hanging-ampersand-position (&optional pos col)
"Return indent column for a hanging ampersand (that is, ^\\s-*&).
-When you know the position and column of the beginning of the
-current environment, supply them as optional arguments POS and
-COL for efficiency."
+When you know the position of the beginning of the current
+environment and indent of its line, supply them as optional
+arguments POS and COL for efficiency."
(cl-destructuring-bind
(beg-pos . beg-col)
(if pos
(cons pos col)
- (LaTeX-env-beginning-pos-col))
+ (LaTeX-env-beginning-pos-indent))
(let ((cur-pos (point)))
(save-excursion
(if (and (search-backward "\\\\" beg-pos t)
@@ -8957,7 +8971,7 @@ COL for efficiency."
"Return indent column for the current tabular-like line."
(cl-destructuring-bind
(beg-pos . beg-col)
- (LaTeX-env-beginning-pos-col)
+ (LaTeX-env-beginning-pos-indent)
(let ((tabular-like-end-regex
(format "\\\\end{%s}"
(regexp-opt
diff --git a/tests/latex/tabular-out.tex b/tests/latex/tabular-out.tex
index 66de0641fa..113c1d1299 100644
--- a/tests/latex/tabular-out.tex
+++ b/tests/latex/tabular-out.tex
@@ -45,11 +45,11 @@
\begin{equation}
\begin{aligned}
&n u m=\left[\begin{array}{ll}
- 2 & 25
- \end{array}\right] \\
+ 2 & 25
+ \end{array}\right] \\
&d e n=\left[\begin{array}{lll}
- 1 & 4 & 25
- \end{array}\right]
+ 1 & 4 & 25
+ \end{array}\right]
\end{aligned}
\end{equation}
- [elpa] externals/auctex 75702683d0 37/37: Merge remote-tracking branch 'origin/master' into externals/auctex, (continued)
- [elpa] externals/auctex 75702683d0 37/37: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 8e4043a899 08/37: ; * latex.el (LaTeX-completion-parse-args): Use `cl-flet'., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 95163c6602 14/37: ; Fix typo and spacing in Texinfo document, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex e2f18de580 23/37: ; * auctex.el.in: Provide the final product., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex f69211af62 03/37: Fix context nl mode, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 7b1d4156b2 32/37: * latex.el (LaTeX-auto-counter-regexp-list): Save regexp groups., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 95d7a81f40 20/37: Fix "Honor file local variables" (bug#65750), Tassilo Horn, 2023/10/11
- [elpa] externals/auctex d9a6c248d0 35/37: ; Minor improvement of documentation, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 91da27754b 13/37: Keep preview images when killing indirect buffer (bug#65462), Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 8c3e73c4bb 07/37: Unbreak in-buffer completion for Emacs prior to v.28, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex aabf144dfb 22/37: Arrange indent of tabular-like environments (bug#65648),
Tassilo Horn <=
- [elpa] externals/auctex c290376d5d 15/37: Allow programmatic folding, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 454f02a588 25/37: Take care of temporal buffers (bug#65912), Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 0df824d5d2 19/37: Remove menu title inconsistency, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex fe3ef154cd 09/37: Support verbatim shorthands defined with fancyvrb package, Tassilo Horn, 2023/10/11
- [elpa] externals/auctex bb5e6c0a27 27/37: Remove let-binding for `max-specpdl-size', Tassilo Horn, 2023/10/11
- [elpa] externals/auctex ad81644cf1 26/37: ; * tex.el (TeX-brace-count-line): Fix last change., Tassilo Horn, 2023/10/11
- [elpa] externals/auctex 34a94db2ae 29/37: * tex.el (plain-TeX-auto-regexp-list): Save regexp groups., Tassilo Horn, 2023/10/11