branch: externals/auctex
commit a228137f66df1d5d9d20972cbcf5467a6a642303
Author: Arash Esbati <[email protected]>
Commit: Arash Esbati <[email protected]>
Don't count braces in verbatim constructs for indentation
* tex.el (TeX-brace-count-line): Ignore open/close braces in
verbatim constructs. (bug#65824)
---
tex.el | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/tex.el b/tex.el
index 18fafcff10..d508a0cb21 100644
--- a/tex.el
+++ b/tex.el
@@ -5496,21 +5496,25 @@ additional characters."
'(?\{ ?\} ?\\))
(TeX-in-comment))))
(forward-char)
- (cond ((memq char (append
- TeX-indent-open-delimiters
- '(?\{)))
- (setq count (+ count TeX-brace-indent-level)))
- ((memq char (append
- TeX-indent-close-delimiters
- '(?\})))
- (setq count (- count TeX-brace-indent-level)))
- ((eq char ?\\)
- (when (< (point) limit)
- ;; ?\\ in verbatim constructs doesn't escape
- ;; the next char
- (unless (TeX-verbatim-p)
- (forward-char))
- t))))))
+ ;; If inside a verbatim construct, just return t and
+ ;; proceed, otherwise start counting:
+ (if (TeX-verbatim-p)
+ t
+ (cond ((memq char (append
+ TeX-indent-open-delimiters
+ '(?\{)))
+ (setq count (+ count TeX-brace-indent-level)))
+ ((memq char (append
+ TeX-indent-close-delimiters
+ '(?\})))
+ (setq count (- count TeX-brace-indent-level)))
+ ((eq char ?\\)
+ (when (< (point) limit)
+ ;; ?\\ in verbatim constructs doesn't escape
+ ;; the next char
+ (unless (TeX-verbatim-p)
+ (forward-char))
+ t)))))))
count)))
;;; Navigation