# HG changeset patch # User Karl Heuer # Date 878339010 0 # Node ID f1a4588c8075cfc22dba8fd10c0d4e97434490be # Parent de9483a63b12fc9d4aa3b98e73508fe644473efa (tex-validate-region): Really check for mismatched parens. diff -r de9483a63b12 -r f1a4588c8075 lisp/textmodes/tex-mode.el --- 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)))))