[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 11d802916f54c3c52fae4
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 11d802916f54c3c52fae4d7f0ed02857661e7f9c |
Date: |
Tue, 19 Jan 2021 12:38:08 -0500 (EST) |
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 11d802916f54c3c52fae4d7f0ed02857661e7f9c (commit)
from 4a114d1efd5a4ec4ad576a5a952e71b06addb5a1 (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 11d802916f54c3c52fae4d7f0ed02857661e7f9c
Author: Tassilo Horn <tsdh@gnu.org>
Date: Tue Jan 19 18:30:37 2021 +0100
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.
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)
-----------------------------------------------------------------------
Summary of changes:
latex.el | 5 +++--
tex.el | 9 +++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
hooks/post-receive
--
GNU AUCTeX
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 11d802916f54c3c52fae4d7f0ed02857661e7f9c,
Tassilo Horn <=