changeset 43830:78c2427665f0

(show-paren-function): Move back in other direction to verify the match is correct.
author Richard M. Stallman <rms@gnu.org>
date Mon, 11 Mar 2002 09:14:28 +0000
parents 7e937c00ff00
children 7837693f5bac
files lisp/paren.el
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/paren.el	Mon Mar 11 09:10:19 2002 +0000
+++ b/lisp/paren.el	Mon Mar 11 09:14:28 2002 +0000
@@ -155,6 +155,14 @@
 	      (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)