[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 19a2607b42 73/77: Unbreak building with Emacs 29 after obsoleting autoload.el, (continued)
- [elpa] externals/auctex 19a2607b42 73/77: Unbreak building with Emacs 29 after obsoleting autoload.el, 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 87b24d0963 45/77: Add support for the Sioyek document viewer, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 23f4040c9d 57/77: Add new test, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 34fd998400 21/77: ; * bib-cite.el (): Silence byte compiler, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 3a1a820bdf 18/77: ; Rearrange code after last commit., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 794ecb01ab 35/77: Fontify \maketitle macro, 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 0029ca410f 77/77: Release GNU AUCTeX 13.1.4, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex ec3877ea7f 74/77: Pacify Emacs 29 compiler warnings, 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 d44f83de8b 37/77: Add three new styles, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 0f59225c0f 70/77: ; * doc/todo.texi (Mid-term Goals): Fix typo., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 2d28bd1630 67/77: Avoid `makeinfo` warnings, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex edabf207b4 65/77: Insert a space between \caption and \\ in tables, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex edb15b8f26 43/77: Follow up the previous commit, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 728db25bf7 69/77: Update documentation, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 33a01b6928 59/77: Extend test for filling, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 5c5aa78de0 71/77: Fix doc string, 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 010a1e24be 01/77: Follow up the previous commit, Tassilo Horn, 2022/08/26