changeset 78795:968a3bca1d34

(blink-matching-open): Don't display message when no paren is found within blink-matching-paren-distance characters. Don't search prompt in blink-matching-paren-distance nil case.
author Martin Rudalics <rudalics@gmx.at>
date Sat, 15 Sep 2007 09:33:37 +0000
parents 5f7e08d29d9f
children 958db0cf0244
files lisp/simple.el
diffstat 1 files changed, 21 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sat Sep 15 08:09:07 2007 +0000
+++ b/lisp/simple.el	Sat Sep 15 09:33:37 2007 +0000
@@ -4481,15 +4481,20 @@
 				 (point))))))
     (let* ((oldpos (point))
 	   blinkpos
-	   message-log-max  ; Don't log messages about paren matching.
+	   message-log-max    ; Don't log messages about paren matching.
 	   matching-paren
-	   open-paren-line-string)
+	   open-paren-line-string
+	   old-start
+	   new-start)
       (save-excursion
 	(save-restriction
-	  (if blink-matching-paren-distance
-	      (narrow-to-region (max (minibuffer-prompt-end)
-				     (- (point) blink-matching-paren-distance))
-				oldpos))
+	  ;; Don't search for matching paren within minibuffer prompt.
+	  (setq old-start (minibuffer-prompt-end))
+	  (setq new-start
+		(if blink-matching-paren-distance
+		    (max old-start (- (point) blink-matching-paren-distance))
+		  old-start))
+	  (narrow-to-region new-start oldpos)
 	  (condition-case ()
 	      (let ((parse-sexp-ignore-comments
 		     (and parse-sexp-ignore-comments
@@ -4505,15 +4510,18 @@
 			  (eq (syntax-class syntax) 4)
 			  (cdr syntax)))))
 	(cond
+	 ((not blinkpos)
+	  (unless (and blink-matching-paren-distance (> new-start old-start))
+	    ;; When `blink-matching-paren-distance' is non-nil and we
+	    ;; didn't find a matching paren within that many characters
+	    ;; don't display a message.
+	    (message "Unmatched parenthesis")))
 	 ((not (or (eq matching-paren (char-before oldpos))
-                   ;; The cdr might hold a new paren-class info rather than
-                   ;; a matching-char info, in which case the two CDRs
-                   ;; should match.
-                   (eq matching-paren (cdr (syntax-after (1- oldpos))))))
+		   ;; The cdr might hold a new paren-class info rather than
+		   ;; a matching-char info, in which case the two CDRs
+		   ;; should match.
+		   (eq matching-paren (cdr (syntax-after (1- oldpos))))))
 	  (message "Mismatched parentheses"))
-	 ((not blinkpos)
-	  (if (not blink-matching-paren-distance)
-	      (message "Unmatched parenthesis")))
 	 ((pos-visible-in-window-p blinkpos)
 	  ;; Matching open within window, temporarily move to blinkpos but only
 	  ;; if `blink-matching-paren-on-screen' is non-nil.