auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 4d58d7d1abd84feb7d975


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 4d58d7d1abd84feb7d975da3c9571a884756ff37
Date: Sat, 11 Jul 2020 02:13:30 -0400 (EDT)

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  4d58d7d1abd84feb7d975da3c9571a884756ff37 (commit)
      from  840973cc6d7736849dfb7cdca9e7e87655bd6315 (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 4d58d7d1abd84feb7d975da3c9571a884756ff37
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Date:   Thu Jul 9 23:26:53 2020 +0900

    Don't extend font lock region too eagerly (bug#42267)
    
    * font-latex.el (font-latex-extend-region-backwards-quotation): If
    there is no matching open quote, don't extend the font lock region.

diff --git a/font-latex.el b/font-latex.el
index d7d26fa..09a6feb 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -2066,19 +2066,33 @@ set to french, and >>german<< (and 8-bit) are used if 
set to german."
                    (setq opening-quote (car elt))
                    (throw 'found nil))))
              ;; Find opening quote taking nested quotes into account.
-             (while (progn
-                      (re-search-backward (concat opening-quote "\\|"
-                                                  closing-quote)
-                                          point-of-surrender 'move)
-                      (when (and (> (point) point-of-surrender)
-                                 (not (bobp)))
-                        (if (string= (match-string 0) closing-quote)
-                            (setq nest-count (1+ nest-count))
-                          (when (/= nest-count 0)
-                            (setq nest-count (1- nest-count)))))))
-             (when (< (point) font-lock-beg)
-                (setq font-lock-beg (point))
-               (throw 'extend t)))))))))
+             (while (and (re-search-backward (concat opening-quote "\\|"
+                                                     closing-quote)
+                                             point-of-surrender t)
+                         ;; Found quotes before point-of-surrender.
+                         (cond ((string= (match-string 0) closing-quote)
+                                ;; Encountered another closing quote.
+                                ;; Increase nest-count and continue
+                                ;; the inner loop.
+                                (setq nest-count (1+ nest-count)))
+                               ;; Found an opening quote.
+                               ((/= nest-count 0)
+                                ;; If in nest, decrease nest-count
+                                ;; and continue the inner loop.
+                                (setq nest-count (1- nest-count)))
+                               ;; Else we arrived at the opening quote
+                               ;; matching with the closing quote found
+                               ;; in the outer loop.
+                               ((< (point) font-lock-beg)
+                                ;; If that opening quote locates
+                                ;; before `font-lock-beg', break the
+                                ;; outer loop and extend the region.
+                                (setq font-lock-beg (point))
+                                (throw 'extend t))
+                               (t
+                                ;; Else terminate the inner loop and
+                                ;; continue the outer loop.
+                                nil)))))))))))
 
 (defun font-latex-match-script (limit)
   "Match subscript and superscript patterns up to LIMIT."

-----------------------------------------------------------------------

Summary of changes:
 font-latex.el | 40 +++++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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