[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 11d8029 16/23: Signal an error if auto-parser re
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 11d8029 16/23: Signal an error if auto-parser regexp has too many groups |
Date: |
Sat, 23 Jan 2021 04:10:09 -0500 (EST) |
branch: externals/auctex
commit 11d802916f54c3c52fae4d7f0ed02857661e7f9c
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
Signal an error if auto-parser regexp has too many groups
In (pathological) documents which activate too many styles adding
entries to TeX-auto-regexp-list, the full regular expression built for
auto-parsing may contain more groups than emacs supports (which is 255
at this point of time). Therefore, signal a clear error in that case
instead of failing unpredictably by resultant problems.
Also, fix another spot where duplicate entries could have been added.
* tex.el (TeX-auto-parse-region): Signal an error if the generated
auto-parser regexp has more than 255 groups.
* latex.el (LaTeX-common-initialization): Ensure we don't add
duplicate entries to TeX-auto-full-regexp-list.
---
latex.el | 5 +++--
tex.el | 9 +++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/latex.el b/latex.el
index c25cc24..6a8b2fd 100644
--- a/latex.el
+++ b/latex.el
@@ -6217,8 +6217,9 @@ function would return non-nil and `(match-string 1)'
would return
(cons (concat "\\" (nth 0 x)) (nth 1 x)))
LaTeX-section-list)))
- (set (make-local-variable 'TeX-auto-full-regexp-list)
- (append LaTeX-auto-regexp-list plain-TeX-auto-regexp-list))
+ (setq-local TeX-auto-full-regexp-list
+ (delete-dups (append LaTeX-auto-regexp-list
+ plain-TeX-auto-regexp-list)))
(LaTeX-set-paragraph-start)
(setq paragraph-separate
diff --git a/tex.el b/tex.el
index 671d287..b59aee0 100644
--- a/tex.el
+++ b/tex.el
@@ -4244,6 +4244,15 @@ you should not use something like `[\\(]' for a
character range."
"\\)"))
syms
lst)
+ ;; TODO: Emacs allows at most 255 groups in a regexp, see the
+ ;; "#define MAX_REGNUM 255" in regex-emacs.c. If our regex
+ ;; has more groups, bad things may happen, e.g.,
+ ;; (match-beginning 271) returns nil although the regexp that
+ ;; matched contains group number 271. Sadly, MAX_REGNUM is
+ ;; not exposed to Lisp, so we need to hard-code it here (and
+ ;; sometimes check if it increased in newer Emacs versions).
+ (when (> count 255)
+ (error "The TeX auto-parser's regexp has too many groups (%d)"
count))
(setq count 0)
(goto-char (if end (min end (point-max)) (point-max)))
(while (re-search-backward regexp beg t)
- [elpa] externals/auctex db98d06 11/23: ; * style/fancyhdr.el: Fix package year., (continued)
- [elpa] externals/auctex db98d06 11/23: ; * style/fancyhdr.el: Fix package year., Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 46c356b 18/23: Update style/multirow.el to package version 2.6, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 3f38eb2 07/23: Support page(box) options for dvipdfmx in graphicx.el, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex a1569ca 12/23: Fix use-package recipe in install docs (once again), Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 74f5675 01/23: Adapt preview.el.in for `TeX-translate-location-hook', Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 2c5c2e1 10/23: Add support for some missing kernel macros, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex ba0b1af 21/23: Prevent inadvertent destruction of list variable, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 18af0a5 13/23: * style/extramarks.el ("extramarks"): Use reference keyword class., Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 8aa5381 14/23: Delete kernel commands from styles, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 4a114d1 15/23: Fix adding duplicates to TeX-auto-regexp-list, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 11d8029 16/23: Signal an error if auto-parser regexp has too many groups,
Tassilo Horn <=
- [elpa] externals/auctex 724da15 17/23: Update style/thmtools.el to package version 0.72, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 931dacf 20/23: ; * style/bigstrut.el: Silence the compiler., Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 696400c 22/23: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 8585c4d 19/23: Update style/bigstrut.el to package version 2.6, Tassilo Horn, 2021/01/23
- [elpa] externals/auctex 7b07019 23/23: Regenerate docs, Tassilo Horn, 2021/01/23