From 903b7f655c275fb21c584ba3e7117508c4274897 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 19 Aug 1995 16:59:43 +0000 Subject: [PATCH] (blink-matching-paren-dont-ignore-comments): New var. (blink-matching-open): Use it. Also, if the matching char hasn't paren syntax, call that mismatch. --- lisp/simple.el | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 38ae6528fd7..5699b1d3503 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2611,6 +2611,9 @@ in the mode line." (defconst blink-matching-delay 1 "*The number of seconds that `blink-matching-open' will delay at a match.") +(defconst blink-matching-paren-dont-ignore-comments nil + "*Non-nil means `blink-matching-paren' should not ignore comments.") + (defun blink-matching-open () "Move cursor momentarily to the beginning of the sexp before point." (interactive) @@ -2632,13 +2635,18 @@ in the mode line." (- (point) blink-matching-paren-distance)) oldpos)) (condition-case () - (setq blinkpos (scan-sexps oldpos -1)) + (let ((parse-sexp-ignore-comments + (and parse-sexp-ignore-comments + (not blink-matching-paren-dont-ignore-comments)))) + (setq blinkpos (scan-sexps oldpos -1))) (error nil))) - (and blinkpos (/= (char-syntax (char-after blinkpos)) - ?\$) + (and blinkpos + (/= (char-syntax (char-after blinkpos)) + ?\$) (setq mismatch - (/= (char-after (1- oldpos)) - (matching-paren (char-after blinkpos))))) + (or (null (matching-paren (char-after blinkpos))) + (/= (char-after (1- oldpos)) + (matching-paren (char-after blinkpos)))))) (if mismatch (setq blinkpos nil)) (if blinkpos (progn -- 2.39.2