diff options
author | Karl Heuer <kwzh@gnu.org> | 1997-10-31 23:03:30 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1997-10-31 23:03:30 +0000 |
commit | 7be62b49f347378cc1ed4d40a2382ffbe75a82bf (patch) | |
tree | 00415a1bbb8431eb841e010f88b0b3c635ad1bef /lisp/textmodes | |
parent | 0d2511da670db116c03b8403136a141764f23d5d (diff) | |
download | emacs-7be62b49f347378cc1ed4d40a2382ffbe75a82bf.tar.gz |
(tex-validate-region): Really check
for mismatched parens.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r-- | lisp/textmodes/tex-mode.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 509b7fd4556..f599c581540 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -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))))) |