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. 605cfc2f0929f431f3ce5


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 605cfc2f0929f431f3ce57e57dfb2a2d8a89e4fa
Date: Thu, 13 May 2021 02:06:34 -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  605cfc2f0929f431f3ce57e57dfb2a2d8a89e4fa (commit)
      from  a6121fb7356cc4c9398b2be6534007d3c5a84518 (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 605cfc2f0929f431f3ce57e57dfb2a2d8a89e4fa
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Date:   Thu May 13 02:33:37 2021 +0900

    Add new test
    
    * tests/latex/font-latex-test.el (font-latex-unclosed-dollars): New
    test.
    * font-latex.el (font-latex-find-dollar-math): Clean up doc string and
    comment.

diff --git a/font-latex.el b/font-latex.el
index 2b03783..da95bc2 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1898,7 +1898,8 @@ The \\begin{equation} incl. arguments in the same line and
   "Find dollar sign(s) before LIMIT.
 Set point just before the found $. Ignore escaped $ (\"\\$\").
 Optional argument NUM, if non-nil, specifies the number of dollar
-signs to follow the point and must be 1 or 2."
+signs to follow the point and must be 1 or 2.
+LIMIT must not exceed the end of buffer."
   (catch 'found
     (while (progn
              (skip-chars-forward "^$" limit)
@@ -1916,7 +1917,7 @@ signs to follow the point and must be 1 or 2."
                    ;; inline math.  We need to consider this %$
                    ;; comments because they are the workaround for
                    ;; falsely triggered math mode due to valid,
-                   ;; non-math occurrences of $.
+                   ;; non-math occurrences of $.  (bug#48365)
                    (not num))))
         (skip-chars-forward "$" limit))
        ;; check 2: Else, is "$" escaped?
@@ -1931,21 +1932,6 @@ signs to follow the point and must be 1 or 2."
         ;; followed by $$ because expressions like "$1+1$$2+2$" and
         ;; "$1+2$$$3+3$$" are legal.
         (forward-char 1))
-       ;; (Quote from bug#19589, with a bit of adaptation)
-       ;;
-       ;; > When I use environment variables (such as $HOME) in a .tex
-       ;; > file, the $ triggers math mode syntax highlighting. The
-       ;; > result is that the rest of the buffer, until the next $,
-       ;; > is highlighted as if it were in math mode. Some examples:
-       ;; > \includegraphics{$HOME/path/to/graphic}
-       ;; > \bibliography{$HOME/path/to/bib}
-       ;;
-       ;; In order to spare workaround of adding "%$" at the end of
-       ;; the lines for such cases, we stay away from the next syntax
-       ;; state check.
-       ;; ;; check 3: Else, is "$" in comments or verb-like construct?
-       ;; ((nth 8 (syntax-ppss))
-       ;;       (skip-chars-forward "$" limit))
        (t
         ;; That "$" is live one.
         (throw 'found t))))))
diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
index 744ffdd..d619942 100644
--- a/tests/latex/font-latex-test.el
+++ b/tests/latex/font-latex-test.el
@@ -43,6 +43,23 @@ $a$")
               (setq font-latex--updated-region-end (point-max))
               (font-latex-match-dollar-math (point-max))))))
 
+(ert-deftest font-latex-unclosed-dollars ()
+  "Test unclosed dollar doesn't cause error."
+  (let ((TeX-install-font-lock #'font-latex-setup))
+    (with-temp-buffer
+      (LaTeX-mode)
+
+      (insert "a$")
+      (goto-char (point-min))
+      (setq font-latex--updated-region-end (point-max))
+      (should (not (font-latex-match-dollar-math (point-max))))
+
+      (erase-buffer)
+      (insert "a$$")
+      (goto-char (point-min))
+      (setq font-latex--updated-region-end (point-max))
+      (should (not (font-latex-match-dollar-math (point-max)))))))
+
 (ert-deftest font-latex-extend-region-backwards-quotation ()
   "Test f-l-e-r-b-q doesn't extend region too eagerly."
   (with-temp-buffer

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

Summary of changes:
 font-latex.el                  | 20 +++-----------------
 tests/latex/font-latex-test.el | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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