emacs-diffs
[Top][All Lists]
Advanced

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

master 6242605 2/2: Fix spurious error in beginning-of-defun in pascal-m


From: Mattias Engdegård
Subject: master 6242605 2/2: Fix spurious error in beginning-of-defun in pascal-mode (bug#41740)
Date: Mon, 22 Jun 2020 03:58:30 -0400 (EDT)

branch: master
commit 62426057310b2332037a26e6f70cd5cc8b2e3a11
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Fix spurious error in beginning-of-defun in pascal-mode (bug#41740)
    
    * lisp/progmodes/pascal.el (pascal-beg-of-defun):
    Ignore errors in forward-sexp.
    * test/lisp/progmodes/pascal-tests.el (pascal-beg-of-defun): New test.
---
 lisp/progmodes/pascal.el            | 2 +-
 test/lisp/progmodes/pascal-tests.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el
index b0191c0..fce059b 100644
--- a/lisp/progmodes/pascal.el
+++ b/lisp/progmodes/pascal.el
@@ -589,7 +589,7 @@ See also `pascal-comment-area'."
   (interactive)
   (catch 'found
     (if (not (looking-at (concat "\\s \\|\\s)\\|" pascal-defun-re)))
-       (forward-sexp 1))
+       (ignore-errors (forward-sexp 1)))
     (let ((nest 0) (max -1) (func 0)
          (reg (concat pascal-beg-block-re "\\|"
                       pascal-end-block-re "\\|"
diff --git a/test/lisp/progmodes/pascal-tests.el 
b/test/lisp/progmodes/pascal-tests.el
index 10d6e04..ed4c6fb 100644
--- a/test/lisp/progmodes/pascal-tests.el
+++ b/test/lisp/progmodes/pascal-tests.el
@@ -52,4 +52,12 @@
         (should (equal completions nil))
         (should (equal point-before point-after))))))
 
+(ert-deftest pascal-beg-of-defun ()
+  (with-temp-buffer
+    (pascal-mode)
+    (insert "program test; procedure p(")
+    (forward-char -1)
+    (pascal-beg-of-defun)
+    (should (equal (point) 15))))
+
 (provide 'pascal-tests)



reply via email to

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