auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 69b78fcc2692e81a31ebd


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 69b78fcc2692e81a31ebdeb23aa82b1f5123e213
Date: Wed, 6 Apr 2022 06:05:27 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  69b78fcc2692e81a31ebdeb23aa82b1f5123e213 (commit)
      from  b2cea2005666a46a0531e2c33168a65d67573cf4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 69b78fcc2692e81a31ebdeb23aa82b1f5123e213
Author: Arash Esbati <arash@gnu.org>
Date:   Wed Apr 6 12:03:49 2022 +0200

    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.

diff --git a/latex.el b/latex.el
index f30a6b5f..2d164832 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 b832d5e2..2d8634e1 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 864f7180..b99319eb 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

-----------------------------------------------------------------------

Summary of changes:
 latex.el                                | 8 ++++++--
 tests/latex/conditionals-indent-in.tex  | 7 +++++++
 tests/latex/conditionals-indent-out.tex | 7 +++++++
 3 files changed, 20 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]