[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] GNU AUCTeX branch, master, updated. f464242eab092e610dda6
From: |
Ikumi Keita |
Subject: |
[AUCTeX-diffs] GNU AUCTeX branch, master, updated. f464242eab092e610dda6b654e6fd197ef649d3e |
Date: |
Wed, 16 Mar 2022 06:56:26 -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 f464242eab092e610dda6b654e6fd197ef649d3e (commit)
from 2be733a3e3e67d778bea4cf0475d8b014b0f4c22 (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 f464242eab092e610dda6b654e6fd197ef649d3e
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Date: Sat Mar 5 00:29:08 2022 +0900
Enable indent by square bracket
* tex.el (TeX-indent-open-delimiters):
(TeX-indent-close-delimiters): New options regarded as additional
open/close delimiters at indentation.
* tex.el (TeX-brace-count-line): Increase indentation inside those
options in addition to "{", "}". In comments, don't ignore those
additional characters.
* latex.el (LaTeX-indent-calculate):
(LaTeX-indent-calculate-last):
Treat chars in `TeX-indent-close-delimiters' in the same way as "}".
diff --git a/latex.el b/latex.el
index 4de97600..142d075c 100644
--- a/latex.el
+++ b/latex.el
@@ -3899,7 +3899,8 @@ outer indentation in case of a commented line. The
symbols
"\\)"))
;; Items.
(+ (LaTeX-indent-calculate-last force-type) LaTeX-item-indent))
- ((looking-at "}")
+ ((memq (char-after) (append
+ TeX-indent-close-delimiters '(?\})))
;; End brace in the start of the line.
(- (LaTeX-indent-calculate-last force-type)
TeX-brace-indent-level))
@@ -4041,7 +4042,9 @@ outer indentation in case of a commented line. The
symbols
LaTeX-item-regexp
"\\)"))
(- LaTeX-item-indent))
- ((looking-at "}")
+ ((memq (char-after) (append
+ TeX-indent-close-delimiters
+ '(?\})))
TeX-brace-indent-level)
(t 0)))))))
diff --git a/tex.el b/tex.el
index 4876ae55..eb32a379 100644
--- a/tex.el
+++ b/tex.el
@@ -5410,6 +5410,20 @@ regardless of its data type."
:group 'TeX-indentation
:type 'integer)
+(defcustom TeX-indent-open-delimiters ""
+ "Additional open delimiters to increase indentation.
+Include \"[\" to indent inside square brackets.
+See `TeX-brace-count-line' and `TeX-indent-close-delimiters'."
+ :group 'TeX-indentation
+ :type '(string :tag "Open delimiters"))
+
+(defcustom TeX-indent-close-delimiters ""
+ "Additional close delimiters to increase indentation.
+Include \"]\" to indent inside square brackets.
+See `TeX-brace-count-line' and `TeX-indent-open-delimiters'."
+ :group 'TeX-indentation
+ :type '(string :tag "Close delimiters"))
+
(defun TeX-comment-indent ()
"Determine the indentation of a comment."
(if (looking-at "%%%")
@@ -5419,17 +5433,32 @@ regardless of its data type."
comment-column)))
(defun TeX-brace-count-line ()
- "Count number of open/closed braces."
+ "Count indent caused by open/closed braces.
+In addition to \"{\" and \"}\", characters in
+`TeX-indent-open-delimiters' and `TeX-indent-close-delimiters'
+are also taken into account. Ignore them when they are escaped
+by \"\\\". In comments, ignore \"{\" and \"}\" but don't ignore
+additional characters."
(save-excursion
(let ((count 0) (limit (line-end-position)) char)
(while (progn
- (skip-chars-forward "^{}\\\\" limit)
- (when (and (< (point) limit) (not (TeX-in-comment)))
- (setq char (char-after))
+ (skip-chars-forward
+ (concat "^{}\\\\"
+ TeX-indent-open-delimiters
+ TeX-indent-close-delimiters)
+ limit)
+ (when (and (< (point) limit)
+ (not (and (memq (setq char (char-after))
+ '(?\{ ?\} ?\\))
+ (TeX-in-comment))))
(forward-char)
- (cond ((eq char ?\{)
+ (cond ((memq char (append
+ TeX-indent-open-delimiters
+ '(?\{)))
(setq count (+ count TeX-brace-indent-level)))
- ((eq char ?\})
+ ((memq char (append
+ TeX-indent-close-delimiters
+ '(?\})))
(setq count (- count TeX-brace-indent-level)))
((eq char ?\\)
(when (< (point) limit)
-----------------------------------------------------------------------
Summary of changes:
latex.el | 7 +++++--
tex.el | 41 +++++++++++++++++++++++++++++++++++------
2 files changed, 40 insertions(+), 8 deletions(-)
hooks/post-receive
--
GNU AUCTeX
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX-diffs] GNU AUCTeX branch, master, updated. f464242eab092e610dda6b654e6fd197ef649d3e,
Ikumi Keita <=