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. 90fcbd44a0f69b7b6511e


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 90fcbd44a0f69b7b6511ef3af33bbc1a09670221
Date: Tue, 21 May 2019 08:07:21 -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  90fcbd44a0f69b7b6511ef3af33bbc1a09670221 (commit)
      from  945ffaf985884b768acaeb1c05086a4f69d3a63a (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 90fcbd44a0f69b7b6511ef3af33bbc1a09670221
Author: Ikumi Keita <address@hidden>
Date:   Tue May 21 20:53:51 2019 +0900

    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.

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.

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

Summary of changes:
 tests/tex/navigation.el | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
 tex.el                  |  8 +++++---
 2 files changed, 59 insertions(+), 3 deletions(-)
 create mode 100644 tests/tex/navigation.el


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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