[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] GNU AUCTeX branch, master, updated. c7e1e47e8d7668cb63c53
From: |
Mosè Giordano |
Subject: |
[AUCTeX-diffs] GNU AUCTeX branch, master, updated. c7e1e47e8d7668cb63c531416d6c7f7dd5b3aa35 |
Date: |
Fri, 12 Dec 2014 16:39:36 +0000 |
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 c7e1e47e8d7668cb63c531416d6c7f7dd5b3aa35 (commit)
from 8dd14550e632d8128314c7235ded9a8979d0379a (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 c7e1e47e8d7668cb63c531416d6c7f7dd5b3aa35
Author: Mosè Giordano <address@hidden>
Date: Fri Dec 12 17:25:40 2014 +0100
[Fix #19281] Allow moodifying environments with macros in their names.
* latex.el (LaTeX-environment-name-regexp): New function.
(LaTeX-modify-environment): Use it.
(LaTeX-find-matching-end): Use `TeX-grop' instead of the
hard-coded "{". Search for the closing of the environment with
`re-search-forward' instead of `search-forward' and use
`LaTeX-environment-name-regexp': this allows to consider
environments with macros in their names. (Bug#19281)
(LaTeX-find-matching-begin): Use `TeX-grop' instead of the
hard-coded "{".
diff --git a/ChangeLog b/ChangeLog
index d0c1160..10063c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-12-12 Mosè Giordano <address@hidden>
+
+ * latex.el (LaTeX-environment-name-regexp): New function.
+ (LaTeX-modify-environment): Use it.
+ (LaTeX-find-matching-end): Use `TeX-grop' instead of the
+ hard-coded "{". Search for the closing of the environment with
+ `re-search-forward' instead of `search-forward' and use
+ `LaTeX-environment-name-regexp': this allows to consider
+ environments with macros in their names. (Bug#19281)
+ (LaTeX-find-matching-begin): Use `TeX-grop' instead of the
+ hard-coded "{".
+
2014-12-09 Mosè Giordano <address@hidden>
* style/babel.el (LaTeX-babel-active-languages): Move `nreverse'
diff --git a/latex.el b/latex.el
index 0022ae2..477ef66 100644
--- a/latex.el
+++ b/latex.el
@@ -729,6 +729,15 @@ environment just inserted, the buffer position just before
(run-hook-with-args 'LaTeX-after-insert-env-hooks
environment env-start env-end)))
+(defun LaTeX-environment-name-regexp ()
+ "Return the regexp matching the name of a LaTeX environment.
+This matches everything different from a TeX closing brace but
+allowing one level of TeX group braces."
+ (concat "\\([^" (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\("
+ (regexp-quote TeX-grop) "[^" (regexp-quote TeX-grcl)
+ (regexp-quote TeX-grop) "]*" (regexp-quote TeX-grcl) "\\)*[^"
+ (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\)"))
+
(defun LaTeX-modify-environment (environment)
"Modify current ENVIRONMENT."
(save-excursion
@@ -736,7 +745,7 @@ environment just inserted, the buffer position just before
(re-search-backward (concat (regexp-quote TeX-esc)
"end"
(regexp-quote TeX-grop)
- " *\\([a-zA-Z*]*\\)"
+ (LaTeX-environment-name-regexp)
(regexp-quote TeX-grcl))
(save-excursion (beginning-of-line 1) (point)))
(replace-match (concat TeX-esc "end" TeX-grop environment TeX-grcl) t t)
@@ -745,7 +754,7 @@ environment just inserted, the buffer position just before
(re-search-forward (concat (regexp-quote TeX-esc)
"begin"
(regexp-quote TeX-grop)
- " *\\([a-zA-Z*]*\\)"
+ (LaTeX-environment-name-regexp)
(regexp-quote TeX-grcl))
(save-excursion (end-of-line 1) (point)))
(replace-match (concat TeX-esc "begin" TeX-grop environment TeX-grcl) t
t)))
@@ -4124,7 +4133,7 @@ environment in commented regions with the same comment
prefix."
(comment-prefix (and in-comment (TeX-comment-prefix)))
(case-fold-search nil))
(save-excursion
- (skip-chars-backward "a-zA-Z \t{")
+ (skip-chars-backward (concat "a-zA-Z \t" (regexp-quote TeX-grop)))
(unless (bolp)
(backward-char 1)
(and (looking-at regexp)
@@ -4143,7 +4152,8 @@ environment in commented regions with the same comment
prefix."
(setq level (1+ level))
(setq level (1- level)))))
(if (= level 0)
- (search-forward "}")
+ (re-search-forward
+ (concat TeX-grop (LaTeX-environment-name-regexp) TeX-grcl))
(error "Can't locate end of current environment"))))
(defun LaTeX-find-matching-begin ()
@@ -4158,7 +4168,7 @@ environment in commented regions with the same comment
prefix."
(in-comment (TeX-in-commented-line))
(comment-prefix (and in-comment (TeX-comment-prefix)))
(case-fold-search nil))
- (skip-chars-backward "a-zA-Z \t{")
+ (skip-chars-backward (concat "a-zA-Z \t" (regexp-quote TeX-grop)))
(unless (bolp)
(backward-char 1)
(and (looking-at regexp)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 12 ++++++++++++
latex.el | 20 +++++++++++++++-----
2 files changed, 27 insertions(+), 5 deletions(-)
hooks/post-receive
--
GNU AUCTeX
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX-diffs] GNU AUCTeX branch, master, updated. c7e1e47e8d7668cb63c531416d6c7f7dd5b3aa35,
Mosè Giordano <=