[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 69b78fcc26 54/60: Don't change in
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 69b78fcc26 54/60: Don't change indentation when defining a conditional |
Date: |
Fri, 8 Apr 2022 11:52:56 -0400 (EDT) |
branch: externals/auctex
commit 69b78fcc2692e81a31ebdeb23aa82b1f5123e213
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Don't change indentation when defining a conditional
* latex.el (LaTeX-indent-level-count): Add an entry for the
"newif" macro where the following \if<foo> is the definition of
the conditional which should not increase the indentation.
Fix docstring.
* tests/latex/conditionals-indent-in.tex:
* tests/latex/conditionals-indent-out.tex: Adjust tests
for the change.
---
latex.el | 8 ++++++--
tests/latex/conditionals-indent-in.tex | 7 +++++++
tests/latex/conditionals-indent-out.tex | 7 +++++++
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/latex.el b/latex.el
index f30a6b5f5c..2d16483249 100644
--- a/latex.el
+++ b/latex.el
@@ -4054,8 +4054,10 @@ outer indentation in case of a commented line. The
symbols
(t (LaTeX-indent-calculate-last force-type))))))
(defun LaTeX-indent-level-count ()
- "Count indentation change caused by all \\left, \\right, \\begin, and
-\\end commands in the current line."
+ "Count indentation change caused by macros in the current line.
+Macros contain \\left, \\right, \\begin, \\end and \\if-\\fi
+constructs. A special case is \\newif where the following
+\\if<foo> should not change the indentation."
(save-excursion
(save-restriction
(let ((count 0))
@@ -4077,6 +4079,8 @@ outer indentation in case of a commented line. The
symbols
(setq count (+ count LaTeX-indent-level)))
((looking-at LaTeX-end-regexp)
(setq count (- count LaTeX-indent-level)))
+ ((looking-at "newif\\b")
+ (search-forward TeX-esc (line-end-position) t))
((and (not (looking-at LaTeX-indent-begin-regexp-exceptions-local))
(looking-at LaTeX-indent-begin-regexp-local))
(setq count (+ count LaTeX-indent-level)))
diff --git a/tests/latex/conditionals-indent-in.tex
b/tests/latex/conditionals-indent-in.tex
index b832d5e2dd..2d8634e1b5 100644
--- a/tests/latex/conditionals-indent-in.tex
+++ b/tests/latex/conditionals-indent-in.tex
@@ -8,6 +8,13 @@
\begin{document}
+\newif\ifluatex
+\ifluatex
+luatex specific code
+\else
+code for other engines
+\fi
+
\def\IfFileExists#1#2#3{%
\openin\@inputcheck#1 %
\ifeof\@inputcheck
diff --git a/tests/latex/conditionals-indent-out.tex
b/tests/latex/conditionals-indent-out.tex
index 864f718090..b99319ebd6 100644
--- a/tests/latex/conditionals-indent-out.tex
+++ b/tests/latex/conditionals-indent-out.tex
@@ -8,6 +8,13 @@
\begin{document}
+\newif\ifluatex
+\ifluatex
+ luatex specific code
+\else
+ code for other engines
+\fi
+
\def\IfFileExists#1#2#3{%
\openin\@inputcheck#1 %
\ifeof\@inputcheck
- [AUCTeX-diffs] [elpa] externals/auctex e032df90e7 05/60: Fix simultaneity, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex e032df90e7 05/60: Fix simultaneity, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex a078fda16b 06/60: ; * doc/auctex.texi (Starting a Command): Delete obosolete comment., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex b1a0d5df74 36/60: ; * style/algpseudocode.el: Fix position of TeX-dialect., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 1bc2630275 20/60: Don't change syntax of ^^A comments in doctex mode (bug#35140), Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex fa8842c626 26/60: Recognize macrocode*? environments in doctex-mode, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 45aff50ff3 48/60: Support \mathcolor in style/x?color.el, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 5d2829aed4 49/60: Remove old defadvices (patch by Stefan Monnier), Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 5cf46ff8e2 52/60: Improve parsing of re-definitions, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 03ed9004cd 60/60: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex c050335dd8 21/60: ; Fix typo, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 69b78fcc26 54/60: Don't change indentation when defining a conditional,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 323eb08ca6 46/60: Assign reasonable sentinel in AmS-TeX mode, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 2af3c1bcbd 33/60: Add new style/ifthen.el, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex e1c3e37e0c 56/60: ; Update copyright year, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 3df1e313ea 25/60: Adapt TeX-region-hook for lexical-binding, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex fded69c292 59/60: Let \Describe<foo> macros stay on their own lines, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 806100f29a 27/60: Delete obsoleted variables (bug#54339), Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 9554d1e8a2 40/60: * doc/changes.texi: Announce the indentation improvement., Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 8460859b69 34/60: Improve fontification of kernel macros, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 494d501e63 43/60: Adjust indenting of conditionals in styles, Tassilo Horn, 2022/04/08
- [AUCTeX-diffs] [elpa] externals/auctex 8e7d19fe84 44/60: Make tex-buf.el compile without (require 'latex), Tassilo Horn, 2022/04/08