[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 605cfc2 14/34: Add new test
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 605cfc2 14/34: Add new test |
Date: |
Sun, 6 Jun 2021 11:40:02 -0400 (EDT) |
branch: externals/auctex
commit 605cfc2f0929f431f3ce57e57dfb2a2d8a89e4fa
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
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.
---
font-latex.el | 20 +++-----------------
tests/latex/font-latex-test.el | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 17 deletions(-)
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
- [AUCTeX-diffs] [elpa] externals/auctex 1ded6fc 24/34: Fix markups in documents, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex 1ded6fc 24/34: Fix markups in documents, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex afab0e0 17/34: Indent region (bug#48518), Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 70907dd 09/34: Skip inline math $ inside comments (bug#48365), Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 3c8e583 08/34: Introduce new variable `LaTeX-global-package-files', Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 8990190 16/34: Improve style/algorithm.el, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex b5f34a9 23/34: Followup my commit on May 6, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex bff3d85 01/34: ; Delete unnecessary escaping of characters, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 7ff3323 03/34: Add support for (Brazilian) Portuguese, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 2a4cbbb 21/34: Improve `TeX-electric-macro' in Texinfo mode, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex dfd6585 33/34: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 605cfc2 14/34: Add new test,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex bb1bb25 27/34: Remove backspace as paragraph separator, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 93d66d1 31/34: Adapt for Texinfo mode, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 154fc6e 28/34: Only re-fill \item contents if auto-fill-mode is active (bug#48760), Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex cd63c11 32/34: Use own error description for LaTeX mode only, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex a21c10a 29/34: Check for `auto-fill-function' before filling, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 34ab611 22/34: Improve completion, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex e7b25d1 26/34: Use #' rather than ' to quote function names, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 1d32138 25/34: ; Silence the compiler, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex 81ce0ee 19/34: Add -dDELAYBIND only when necessary, Tassilo Horn, 2021/06/06
- [AUCTeX-diffs] [elpa] externals/auctex c540e3a 30/34: Define minor modes using keywords, Tassilo Horn, 2021/06/06