[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 4a3d7a2dc2 60/77: Suppress indentation of verbat
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 4a3d7a2dc2 60/77: Suppress indentation of verbatim env's in docTeX-mode |
Date: |
Fri, 26 Aug 2022 16:06:37 -0400 (EDT) |
branch: externals/auctex
commit 4a3d7a2dc24df3c0013498baf5ae2df3c23210fb
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Suppress indentation of verbatim env's in docTeX-mode
* latex.el (docTeX-indent-inner-fixed): Add entry for verbatim*?
environments.
(LaTeX-indent-line): Add a check in order to suppress
the calculation of indentation inside verbatim environments in
docTeX-mode.
* tests/latex/doctex-indent-in.dtx:
* tests/latex/doctex-indent-out.dtx: Update test.
---
latex.el | 28 ++++++++++++++++++----------
tests/latex/doctex-indent-in.dtx | 6 ++++++
tests/latex/doctex-indent-out.dtx | 6 ++++++
3 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/latex.el b/latex.el
index e8b8140952..eb91e697fe 100644
--- a/latex.el
+++ b/latex.el
@@ -3910,7 +3910,10 @@ value."
4 t)
(,(concat (regexp-quote TeX-esc)
"\\(begin\\|end\\)[ \t]*{\\(macro\\|environment\\)\\*?}")
- 0 nil))
+ 0 nil)
+ (,(concat (regexp-quote TeX-esc)
+ "\\(begin\\|end\\)[ \t]*{verbatim\\*?}")
+ 0 t))
"List of items which should have a fixed inner indentation.
The items consist of three parts. The first is a regular
expression which should match the respective string. The second
@@ -4042,13 +4045,18 @@ Lines starting with an item is given an extra
indentation of
(concat (match-string 0) (TeX-comment-padding-string))))))
(save-excursion
(cond ((and fill-prefix
- (TeX-in-line-comment)
- (eq major-mode 'doctex-mode))
+ (eq major-mode 'doctex-mode)
+ (TeX-in-line-comment))
;; If point is in a line comment in `doctex-mode' we only
- ;; consider the inner indentation.
- (let ((inner-indent (LaTeX-indent-calculate 'inner)))
- (when (/= (LaTeX-current-indentation 'inner) inner-indent)
- (LaTeX-indent-inner-do inner-indent))))
+ ;; consider the inner indentation. An exception is when
+ ;; we're inside a verbatim environment where we don't
+ ;; want to touch the indentation, notably with a
+ ;; fill-prefix "% ":
+ (unless (member (LaTeX-current-environment)
+ (LaTeX-verbatim-environments))
+ (let ((inner-indent (LaTeX-indent-calculate 'inner)))
+ (when (/= (LaTeX-current-indentation 'inner) inner-indent)
+ (LaTeX-indent-inner-do inner-indent)))))
((and fill-prefix
LaTeX-syntactic-comments)
;; In any other case of a comment we have to consider
@@ -4057,16 +4065,16 @@ Lines starting with an item is given an extra
indentation of
(let ((inner-indent (LaTeX-indent-calculate 'inner))
(outer-indent (LaTeX-indent-calculate 'outer)))
(when (/= (LaTeX-current-indentation 'inner) inner-indent)
- (LaTeX-indent-inner-do inner-indent))
+ (LaTeX-indent-inner-do inner-indent))
(when (/= (LaTeX-current-indentation 'outer) outer-indent)
- (LaTeX-indent-outer-do outer-indent))))
+ (LaTeX-indent-outer-do outer-indent))))
(t
;; The default is to adapt whitespace before any
;; non-whitespace character, i.e. to do outer
;; indentation.
(let ((outer-indent (LaTeX-indent-calculate 'outer)))
(when (/= (LaTeX-current-indentation 'outer) outer-indent)
- (LaTeX-indent-outer-do outer-indent))))))
+ (LaTeX-indent-outer-do outer-indent))))))
(when (< (current-column) (save-excursion
(LaTeX-back-to-indentation) (current-column)))
(LaTeX-back-to-indentation))))
diff --git a/tests/latex/doctex-indent-in.dtx b/tests/latex/doctex-indent-in.dtx
index 4f439588a7..8d6081ca8d 100644
--- a/tests/latex/doctex-indent-in.dtx
+++ b/tests/latex/doctex-indent-in.dtx
@@ -33,6 +33,12 @@
% \DescribeEnv{YOURENV}
% Put description of |YOURENV| here.
%
+%\begin{verbatim}
+% Some
+%verbatim
+% content
+%\end{verbatim}
+%
% \StopEventually{\PrintIndex}
%
% \section{Implementation}
diff --git a/tests/latex/doctex-indent-out.dtx
b/tests/latex/doctex-indent-out.dtx
index 2bdcf40cbe..432d969b9b 100644
--- a/tests/latex/doctex-indent-out.dtx
+++ b/tests/latex/doctex-indent-out.dtx
@@ -33,6 +33,12 @@
% \DescribeEnv{YOURENV}
% Put description of |YOURENV| here.
%
+%\begin{verbatim}
+% Some
+%verbatim
+% content
+%\end{verbatim}
+%
% \StopEventually{\PrintIndex}
%
% \section{Implementation}
- [elpa] externals/auctex e30fda8130 26/77: ; Really silence the compiler for the change in 37e5a450, (continued)
- [elpa] externals/auctex e30fda8130 26/77: ; Really silence the compiler for the change in 37e5a450, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 59ef475125 30/77: Simplify regexp, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 60ca36b5a1 39/77: ; * .gitignore: Exclude temp files produced by 2022-06-01 kernel., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex d1f2c2cdb2 41/77: Add new style/proc.el, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 054b38887b 42/77: Fix (void-variable compilation-in-progress) error, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex b24dcb4feb 40/77: Track changes in LaTeX kernel 2022-06-01, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 4163bb5c42 66/77: Fix `autoconf` warnings, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex ead30464d8 64/77: * style/listings.el (TeX-add-style-hook): Update fontification., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 7d7e563862 34/77: * doc/changes.texi: Add NEWS item for the previous commit., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 6e25d11aa6 44/77: Add comment, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 4a3d7a2dc2 60/77: Suppress indentation of verbatim env's in docTeX-mode,
Tassilo Horn <=
- [elpa] externals/auctex ce4bb7c1b6 58/77: ; * style/doc.el: Delete spurious `declare-function'., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex d1d1bd819d 47/77: Control the opening and closing braces during insertion, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 23f4040c9d 57/77: Add new test, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 04b9a6d1f9 56/77: Improve shortvrb.sty support, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 33a01b6928 59/77: Extend test for filling, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex e194656ce2 28/77: Let RefTeX recognize labels in user defined environments, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 64a8e189a3 19/77: Remove compatibility code, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 6fe2f21e96 31/77: ; Fix warnings about single quotes in docstrings, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 019bcc9cc3 48/77: ; * style/proc.el: Fix a typo., Tassilo Horn, 2022/08/26