changeset 20203:f1a4588c8075

(tex-validate-region): Really check for mismatched parens.
author Karl Heuer <kwzh@gnu.org>
date Fri, 31 Oct 1997 23:03:30 +0000
parents de9483a63b12
children 44f91b648e03
files lisp/textmodes/tex-mode.el
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/tex-mode.el	Fri Oct 31 23:01:48 1997 +0000
+++ b/lisp/textmodes/tex-mode.el	Fri Oct 31 23:03:30 1997 +0000
@@ -834,9 +834,20 @@
       (condition-case ()
 	  (save-restriction
 	    (narrow-to-region start end)
+	    ;; First check that the open and close parens balance in numbers.
 	    (goto-char start)
 	    (while (< 0 (setq max-possible-sexps (1- max-possible-sexps)))
-	      (forward-sexp 1)))
+	      (forward-sexp 1))
+	    ;; Now check that like matches like.
+	    (goto-char start)
+	    (while (progn (skip-syntax-forward "^(")
+			  (not (eobp)))
+	      (let ((match (matching-paren (following-char))))
+		(save-excursion
+		  (forward-sexp 1)
+		  (or (= (preceding-char) match)
+		      (error "Mismatched parentheses"))))
+	      (forward-char 1)))
 	(error
 	  (skip-syntax-forward " .>")
 	  (setq failure-point (point)))))