]> git.eshelyaron.com Git - emacs.git/commitdiff
(tex-validate-region): Really check
authorKarl Heuer <kwzh@gnu.org>
Fri, 31 Oct 1997 23:03:30 +0000 (23:03 +0000)
committerKarl Heuer <kwzh@gnu.org>
Fri, 31 Oct 1997 23:03:30 +0000 (23:03 +0000)
for mismatched parens.

lisp/textmodes/tex-mode.el

index 509b7fd4556dc1fa3802def1b81238397d225bae..f599c5815400a251fea245817baf5edf260b32a8 100644 (file)
@@ -834,9 +834,20 @@ area if a mismatch is found."
       (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)))))