summaryrefslogtreecommitdiff
path: root/lisp/paren.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-03-11 09:14:28 +0000
committerRichard M. Stallman <rms@gnu.org>2002-03-11 09:14:28 +0000
commit6be7b1272d4ff15bb13fbd3110217777706d0f6a (patch)
tree769830183f1c3c598302a35931f4777fdd586af4 /lisp/paren.el
parentf8e7eebe8330226ab20d42b2337ee79b6b7273ea (diff)
downloademacs-6be7b1272d4ff15bb13fbd3110217777706d0f6a.tar.gz
(show-paren-function): Move back in other direction
to verify the match is correct.
Diffstat (limited to 'lisp/paren.el')
-rw-r--r--lisp/paren.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/paren.el b/lisp/paren.el
index fa68e26203f..000854a01d2 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -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)