From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Herbert Euler Newsgroups: gmane.emacs.devel Subject: Not appropriate message for mismatched parens Date: Wed, 25 Apr 2007 19:01:23 +0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0596455904==" X-Trace: sea.gmane.org 1177498897 11229 80.91.229.12 (25 Apr 2007 11:01:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 Apr 2007 11:01:37 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 25 13:01:35 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HgfFd-0005bi-1g for ged-emacs-devel@m.gmane.org; Wed, 25 Apr 2007 13:01:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HgfLE-0003uG-Na for ged-emacs-devel@m.gmane.org; Wed, 25 Apr 2007 07:07:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HgfLA-0003uB-JK for emacs-devel@gnu.org; Wed, 25 Apr 2007 07:07:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HgfL9-0003tz-3F for emacs-devel@gnu.org; Wed, 25 Apr 2007 07:07:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HgfL8-0003tw-Sr for emacs-devel@gnu.org; Wed, 25 Apr 2007 07:07:14 -0400 Original-Received: from bay0-omc2-s13.bay0.hotmail.com ([65.54.246.149]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HgfFV-0000QV-QS for emacs-devel@gnu.org; Wed, 25 Apr 2007 07:01:26 -0400 Original-Received: from BAY143-W19 ([65.55.154.54]) by bay0-omc2-s13.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Wed, 25 Apr 2007 04:01:24 -0700 X-Originating-IP: [202.165.107.100] Importance: Normal X-OriginalArrivalTime: 25 Apr 2007 11:01:24.0346 (UTC) FILETIME=[107E25A0:01C78729] X-detected-kernel: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:70087 Archived-At: --===============0596455904== Content-Type: multipart/alternative; boundary="_f5219d6f-55b5-4f16-929e-9c658e7dd23b_" --_f5219d6f-55b5-4f16-929e-9c658e7dd23b_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable The variable `blink-matching-paren-distance' limits searching regionfor bli= nking matching parens. However, the error message for the casein which the= distance between the opening paren and the closing parenis larger than `bl= ink-matching-paren-distance' is not so veryappropriate. It says "Mismatche= d parenthesis", just the same as forthe normal cases.This may be not the tr= uth in some cases. The truth is possibly theparens _are matched_, but the = distance between them exceeds the valueof `blink-matching-paren-distance'. = In such a case, saying"Mismatched parenthesis" could confuse the user.I wr= ote a patch, please check it:*** simple.el~ Wed Apr 25 18:25:55 2007--- si= mple.el Wed Apr 25 18:56:34 2007*************** (defun blink-matching-ope= n ()*** 4483,4491 **** blinkpos message-log-max ; Don'= t log messages about paren matching. matching-paren! ope= n-paren-line-string) (save-excursion (save-restriction = (if blink-matching-paren-distance (narrow-to-region (max (m= inibuffer-prompt-end) (- (point) blink-= matching-paren-distance))--- 4483,4496 ---- blinkpos me= ssage-log-max ; Don't log messages about paren matching. matchin= g-paren! open-paren-line-string! open-paren-may-be-outsid= e) (save-excursion (save-restriction+ (setq open-pare= n-may-be-outside+ (and blink-matching-paren-distance+ = (< (minibuffer-prompt-end)+ (- (point) bl= ink-matching-paren-distance)))) (if blink-matching-paren-distance = (narrow-to-region (max (minibuffer-prompt-end) = (- (point) blink-matching-paren-distance))************= *** (defun blink-matching-open ()*** 4510,4519 **** ;; = a matching-char info, in which case the two CDRs ;; sho= uld match. (eq matching-paren (cdr (syntax-after (1- ol= dpos))))))! (message "Mismatched parentheses")) ((not blink= pos) (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.--- 4515,4530 -= --- ;; a matching-char info, in which case the two CDRs= ;; should match. (eq matching-pare= n (cdr (syntax-after (1- oldpos))))))! (if open-paren-may-be-outsid= e! (message (concat "Open parenthesis is not found in the regio= n "! "restricted by `blink-matching-paren-dist= ance'"))! (message "Mismatched parentheses"))) ((not blin= kpos) (if (not blink-matching-paren-distance)! (messag= e "Unmatched parenthesis")! (if open-paren-may-be-outside! = (message (concat "Open parenthesis is not found in the region "! = "restricted by `blink-matching-parent-distance= '"))))) ((pos-visible-in-window-p blinkpos) ;; Matching op= en within window, temporarily move to blinkpos but only ;; if `bli= nk-matching-paren-on-screen' is non-nil.Regards,Guanpeng Xu _________________________________________________________________ Connect to the next generation of MSN Messenger=A0 http://imagine-msn.com/messenger/launch80/default.aspx?locale=3Den-us&sourc= e=3Dwlmailtagline= --_f5219d6f-55b5-4f16-929e-9c658e7dd23b_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable The variable `blink-matching-paren-distance' limits searching region
for= blinking matching parens.  However, the error message for the casein which the distance between the opening paren and the closing paren
i= s larger than `blink-matching-paren-distance' is not so very
appropriate= .  It says "Mismatched parenthesis", just the same as for
the norma= l cases.

This may be not the truth in some cases.  The truth is= possibly the
parens _are matched_, but the distance between them exceed= s the value
of `blink-matching-paren-distance'.  In such a case, sa= ying
"Mismatched parenthesis" could confuse the user.

I wrote a p= atch, please check it:

*** simple.el~  Wed Apr 25 18:25:55 2007=
--- simple.el   Wed Apr 25 18:56:34 2007
*************** (= defun blink-matching-open ()
*** 4483,4491 ****
   &nb= sp;       blinkpos
    = ;       message-log-max  ; Don't log mes= sages about paren matching.
       &n= bsp;   matching-paren
!      &nb= sp;   open-paren-line-string)
     &n= bsp;  (save-excursion
        (s= ave-restriction
          (= if blink-matching-paren-distance
      &nb= sp;       (narrow-to-region (max (minibuffer-= prompt-end)
          =             &nb= sp;            =   (- (point) blink-matching-paren-distance))
--- 4483,4496 ----
=            blinkpos
&n= bsp;          message-log-max&= nbsp; ; Don't log messages about paren matching.
    = ;       matching-paren
!   =        open-paren-line-string
!  = ;        open-paren-may-be-outside)
&= nbsp;       (save-excursion
  &n= bsp;     (save-restriction
+    =      (setq open-paren-may-be-outside
+  &n= bsp;            (and= blink-matching-paren-distance
+      &nbs= p;             = (< (minibuffer-prompt-end)
+       = ;            &n= bsp;   (- (point) blink-matching-paren-distance))))
 &nbs= p;        (if blink-matching-paren-dista= nce
           &n= bsp;  (narrow-to-region (max (minibuffer-prompt-end)
  &n= bsp;            = ;            &n= bsp;         (- (point) blink-match= ing-paren-distance))
*************** (defun blink-matching-open ()
**= * 4510,4519 ****
         &= nbsp;           ;; a matc= hing-char info, in which case the two CDRs
     = ;            &n= bsp;   ;; should match.
      &n= bsp;            = ;  (eq matching-paren (cdr (syntax-after (1- oldpos))))))
! &n= bsp;       (message "Mismatched parentheses")= )
         ((not blinkpos)
&n= bsp;         (if (not blink-matchin= g-paren-distance)
!         = ;    (message "Unmatched parenthesis")))
  &nbs= p;      ((pos-visible-in-window-p blinkpos)
&nb= sp;         ;; Matching open within= window, temporarily move to blinkpos but only
    &= nbsp;     ;; if `blink-matching-paren-on-screen' is non= -nil.
--- 4515,4530 ----
       &n= bsp;            = ; ;; a matching-char info, in which case the two CDRs
   =             &nb= sp;     ;; should match.
    &nb= sp;            =     (eq matching-paren (cdr (syntax-after (1- oldpos))))))!         (if open-paren-may-be-o= utside
!          &nbs= p;  (message (concat "Open parenthesis is not found in the region "!            &= nbsp;           &nbs= p;     "restricted by `blink-matching-paren-distance'")= )
!           (message= "Mismatched parentheses")))
       &= nbsp; ((not blinkpos)
        &n= bsp; (if (not blink-matching-paren-distance)
!    &n= bsp;        (message "Unmatched parenthe= sis")
!           (if = open-paren-may-be-outside
!       &nb= sp;       (message (concat "Open parenthesis = is not found in the region "
!       =             &nb= sp;            "rest= ricted by `blink-matching-parent-distance'")))))
    = ;     ((pos-visible-in-window-p blinkpos)
 &nbs= p;        ;; Matching open within window= , temporarily move to blinkpos but only
     &n= bsp;    ;; if `blink-matching-paren-on-screen' is non-nil.
Regards,
Guanpeng Xu


Connect to the next generation= of MSN Messenger=A0 Get it = now! = --_f5219d6f-55b5-4f16-929e-9c658e7dd23b_-- --===============0596455904== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============0596455904==--