branch: externals/auctex
commit 9cfd5d895aad0fa2399f5fcca7f3a08c0a153f20
Author: Tassilo Horn <[email protected]>
Commit: Tassilo Horn <[email protected]>
Improve LaTeX-find-matching-end
* latex.el (LaTeX-find-matching-end): Find correct end when point
is already on the name in \end{name}.
---
ChangeLog | 5 +++++
latex.el | 9 +++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5ad0ddf..94040d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-22 Tassilo Horn <[email protected]>
+
+ * latex.el (LaTeX-find-matching-end): Find correct end when point
+ is already on the name in \end{name}.
+
2015-09-20 Mos� Giordano <[email protected]>
* .gitignore: Do not ignore auto.el.
diff --git a/latex.el b/latex.el
index 8f613c2..2aa2d94 100644
--- a/latex.el
+++ b/latex.el
@@ -4198,13 +4198,14 @@ 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))
- (save-excursion
+ (let ((pt (point)))
(skip-chars-backward (concat "a-zA-Z \t" (regexp-quote TeX-grop)))
(unless (bolp)
(backward-char 1)
- (and (looking-at regexp)
- (char-equal (char-after (1+ (match-beginning 0))) ?e)
- (setq level 0))))
+ (if (and (looking-at regexp)
+ (char-equal (char-after (1+ (match-beginning 0))) ?e))
+ (setq level 0)
+ (goto-char pt))))
(while (and (> level 0) (re-search-forward regexp nil t))
(when (or (and LaTeX-syntactic-comments
(eq in-comment (TeX-in-commented-line))