]> code.delx.au - gnu-emacs/commitdiff
(show-paren-function): Move back in other direction
authorRichard M. Stallman <rms@gnu.org>
Mon, 11 Mar 2002 09:14:28 +0000 (09:14 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 11 Mar 2002 09:14:28 +0000 (09:14 +0000)
to verify the match is correct.

lisp/paren.el

index fa68e26203f079d44af788cbe9b147bd2e941856..000854a01d2fe2b1fea41e66d7f36fd2fbc954d9 100644 (file)
@@ -155,6 +155,14 @@ in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time."
              (condition-case ()
                  (setq pos (scan-sexps (point) dir))
                (error (setq pos t mismatch t)))
+             ;; Move back the other way and verify we get back to the
+             ;; starting point.  If not, these two parens don't really match.
+             ;; Maybe the one at point is escaped and doesn't really count.
+             (when (integerp pos)
+               (unless (condition-case ()
+                           (eq (point) (scan-sexps pos (- dir)))
+                         (error nil))
+                 (setq pos nil)))
              ;; If found a "matching" paren, see if it is the right
              ;; kind of paren to match the one we started at.
              (when (integerp pos)