[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 90fcbd4 41/80: Make navigation function robust
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 90fcbd4 41/80: Make navigation function robust |
Date: |
Wed, 16 Oct 2019 11:07:14 -0400 (EDT) |
branch: externals/auctex
commit 90fcbd44a0f69b7b6511ef3af33bbc1a09670221
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
Make navigation function robust
* tex.el (TeX-find-macro-end-helper): Cater for corner case that the
`while' loop is exited or skipped.
* tests/tex/navigation.el: Add new test.
---
tests/tex/navigation.el | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
tex.el | 8 +++++---
2 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/tests/tex/navigation.el b/tests/tex/navigation.el
new file mode 100644
index 0000000..daf1840
--- /dev/null
+++ b/tests/tex/navigation.el
@@ -0,0 +1,54 @@
+;;; navigation.el --- tests for navigation function in TeX buffer
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Code:
+
+(require 'ert)
+(require 'tex)
+
+(defun TeX-check-f-m-e-h (string &optional position)
+ "Check whether `TeX-find-macro-end-helper' works for exceptional case."
+ (with-temp-buffer
+ (insert string)
+ (should (= (or position (point-max))
+ (TeX-find-macro-end-helper (point-min))))))
+
+(ert-deftest TeX-find-macro-end-helper-single ()
+ ;; single macro ending at EOB
+ (TeX-check-f-m-e-h "\\foo"))
+
+(ert-deftest TeX-find-macro-end-helper-curly ()
+ ;; curly braces ending at EOB
+ (TeX-check-f-m-e-h "\\foo{bar}"))
+
+(ert-deftest TeX-find-macro-end-helper-curly-fail ()
+ ;; curly brace failing to close at EOB
+ (TeX-check-f-m-e-h "\\foo{bar"))
+
+(ert-deftest TeX-find-macro-end-helper-square ()
+ ;; square brackets ending at EOB
+ (TeX-check-f-m-e-h "\\foo{bar}[baz]"))
+
+(ert-deftest TeX-find-macro-end-helper-square-fail ()
+ ;; square bracket failing to close at EOB
+ (TeX-check-f-m-e-h "\\foo{bar}[baz" (1+ (length "\\foo{bar}"))))
+
+;;; navigation.el ends here
diff --git a/tex.el b/tex.el
index 0fda0d5..de8c6cf 100644
--- a/tex.el
+++ b/tex.el
@@ -5484,10 +5484,12 @@ those will be considered part of it."
;; If we cannot find a regular end, use the
;; next whitespace.
(save-excursion (skip-chars-forward "^ \t\n")
- (point))))
- (when (eobp) (throw 'found (point))))
+ (point)))))
(t
- (throw 'found (point)))))))))
+ (throw 'found (point)))))
+ ;; Make sure that this function does not return nil, even
+ ;; when the above `while' loop is totally skipped. (bug#35638)
+ (throw 'found (point))))))
(defun TeX-find-macro-start (&optional limit)
"Return the start of a macro.
- [elpa] externals/auctex 8610189 52/80: Update style/paracol.el to package version 1.35, (continued)
- [elpa] externals/auctex 8610189 52/80: Update style/paracol.el to package version 1.35, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex c64d8c1 61/80: * doc/changes.texi: Mention fontification improvement for biblatex., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 2c23247 62/80: Support explicitly numbered group contructs, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex dac5503 64/80: Add new style/ltugboat.el, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 52e0dac 68/80: Improve detecting of rejected optional arguments, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 9127647 69/80: Update style/varioref.el to package version 1.6b, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex eafb114 75/80: Fix preview-latex for TeXLive 2019 update, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex cdb98c6 34/80: Fix last commit, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 0fd9848 35/80: Improve style/mflogo.el, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 1b88eda 38/80: Fix autoload generation code (bug#35758), Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 90fcbd4 41/80: Make navigation function robust,
Tassilo Horn <=
- [elpa] externals/auctex c07e4bf 49/80: Update style/AnonymousPro.el to package version 2.2, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex a9b5eb1 67/80: ; * style/changelog.el (font-latex-add-keywords): Silence the compiler., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex dc5e90e 66/80: Add new style/multitoc.el, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex c5e47f8 80/80: ; Recompile using GNUMakefile after merge from origin/master, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex ff688b9 33/80: Stop depreciated usage of undeclared dynamic variable, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 3e179f8 53/80: Update style/fvextra.el to package version 1.4, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 3542a23 70/80: Update style/subcaption.el to package version 1.3, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 7cb6c19 59/80: Fix lisp example for `TeX-electric-math', Tassilo Horn, 2019/10/16
- [elpa] externals/auctex a033c30 43/80: ; Use `LaTeX-extract-key-value-label', Tassilo Horn, 2019/10/16
- [elpa] externals/auctex aa17420 46/80: ; Silence the compiler, Tassilo Horn, 2019/10/16