[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex f464242eab 29/60: Enable indent by square bracke
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex f464242eab 29/60: Enable indent by square bracket |
Date: |
Fri, 8 Apr 2022 11:52:50 -0400 (EDT) |
branch: externals/auctex
commit f464242eab092e610dda6b654e6fd197ef649d3e
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
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 "}".
---
latex.el | 7 +++++--
tex.el | 41 +++++++++++++++++++++++++++++++++++------
2 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/latex.el b/latex.el
index 4de9760016..142d075c66 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 4876ae55b6..eb32a37918 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)
- [elpa] externals/auctex updated (8ff369bd92 -> 03ed9004cd), Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 0847db39c9 03/60: Improve file query in style/ltxtable.el, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex e625dc05ea 01/60: Improve keymap handling, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 259ffc34c4 12/60: Use DEFAULT argument of `TeX-read-string' in styles, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 90b1803b02 10/60: Use DEFAULT argument in latex.el where appropriate, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex ab3bfaf103 13/60: Don't use obsolete font-lock-syntactic-keywords, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex c731038844 11/60: Improve regexp matching new environments, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 3e95554c27 19/60: Reduce code duplication in style/sidecap.el, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex b7d45e19c6 22/60: Discard obsolete hook, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex f9356664c8 23/60: Update documentation, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex f464242eab 29/60: Enable indent by square bracket,
Tassilo Horn <=
- [elpa] externals/auctex 2be733a3e3 28/60: Add new style/l3doc.el, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 4bcda2d50c 35/60: Improve indentation in env from algpseudocode package, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 8938787491 37/60: ; * style/algpseudocode.el ("algpseudocode"): Fix "While"., Tassilo Horn, 2022/04/08
- [elpa] externals/auctex b3d4a509d0 39/60: ; * doc/auctex.texi (Indenting): Fix wording., Tassilo Horn, 2022/04/08
- [elpa] externals/auctex c43d21326d 42/60: Follow similar update of latex.el in context.el, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex b2cea20056 53/60: ; Delete unnecessary quoting in docstrings, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex eb4e331bd6 51/60: Add news for new indent feature, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 1823017839 55/60: Wrap the 'function' environment better with %, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 7119e9b58c 14/60: ; Fix tests relying on font-lock has put syntax properties already, Tassilo Horn, 2022/04/08
- [elpa] externals/auctex 163dcb75bd 02/60: Fix label insertion at env. insertion with active region (bug#28382), Tassilo Horn, 2022/04/08