emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/auctex 3a809a9 18/27: Fix regression of font lock


From: Tassilo Horn
Subject: [elpa] externals/auctex 3a809a9 18/27: Fix regression of font lock
Date: Sat, 27 Jun 2020 03:17:44 -0400 (EDT)

branch: externals/auctex
commit 3a809a9684eaebb0e23bcf2774747891c5b93a57
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>

    Fix regression of font lock
    
    * font-latex.el (font-latex-match-math-envII): Store the position of
    "\begin{foo}" as (match-beginnig 0) so that `font-lock-multiline' text
    property covers it. Store the range of math expression as
    subexpression 1.
    (font-latex-make-user-keywords): Arrange in accord with the above
    change.
---
 font-latex.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/font-latex.el b/font-latex.el
index 449c2d1..ad2153f 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -849,7 +849,7 @@ Generated by `font-latex-make-user-keywords'.")))
              (0 'font-latex-warning-face t t)
              (1 'font-latex-math-face append t))
             (font-latex-match-math-envII
-             (0 'font-latex-math-face append t))
+             (1 'font-latex-math-face append t))
             (font-latex-match-simple-command
              (0 'font-latex-sedate-face append))
             (font-latex-match-script
@@ -1810,13 +1810,13 @@ The \\begin{equation} incl. arguments in the same line 
and
                                   ;; the \end{<env>} construct below
                                   "\\(\\*?}\\)"
                                   ;; Match an optional and possible
-                                  ;; mandatory argument(s) as long as
-                                  ;; they are on the same line with
-                                  ;; no spaces in-between
+                                  ;; mandatory argument(s). They can
+                                  ;; span multiple lines.
                                   
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
                                   "\\(?:{[^}]*}\\)*")
                           limit t)
-    (let ((beg (match-end 0)) end)
+    (let ((beg (match-end 0)) end
+         (beg-of-begin (match-beginning 0)))
       (if (re-search-forward (concat "\\\\end[ \t]*{"
                                     (regexp-quote
                                      (buffer-substring-no-properties
@@ -1831,8 +1831,12 @@ The \\begin{equation} incl. arguments in the same line 
and
              (font-lock-unfontify-region font-latex--updated-region-end end)
              (setq font-latex--updated-region-end end)))
        (goto-char beg)
-       (setq end beg))
-      (store-match-data (list beg end))
+       (setq end beg
+             beg-of-begin beg))
+      ;; Store the position of "\begin{foo}" as (match-beginnig 0) so
+      ;; that `font-lock-multiline' text property covers it. This keeps
+      ;; editing inside multi-line optional argument sane.
+      (store-match-data (list beg-of-begin end beg end))
       t)))
 
 (defun font-latex-match-dollar-math (limit)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]