unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Not appropriate message for mismatched parens
@ 2007-04-25 11:01 Herbert Euler
  2007-04-25 11:13 ` Herbert Euler
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Herbert Euler @ 2007-04-25 11:01 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 3568 bytes --]


The variable `blink-matching-paren-distance' limits searching regionfor blinking matching parens.  However, the error message for the casein which the distance between the opening paren and the closing parenis larger than `blink-matching-paren-distance' is not so veryappropriate.  It says "Mismatched parenthesis", just the same as forthe normal cases.This may be not the truth 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 wrote a patch, 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 ****           blinkpos           message-log-max  ; Don't log messages about paren matching.           matching-paren!          open-paren-line-string)        (save-excursion        (save-restriction          (if blink-matching-paren-distance              (narrow-to-region (max (minibuffer-prompt-end)                                     (- (point) blink-matching-paren-distance))--- 4483,4496 ----           blinkpos           message-log-max  ; Don't log messages about paren matching.           matching-paren!          open-paren-line-string!          open-paren-may-be-outside)        (save-excursion        (save-restriction+         (setq open-paren-may-be-outside+               (and blink-matching-paren-distance+                    (< (minibuffer-prompt-end)+                       (- (point) blink-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                     ;; 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.--- 4515,4530 ----                     ;; a matching-char info, in which case the two CDRs                     ;; should match.                     (eq matching-paren (cdr (syntax-after (1- oldpos))))))!         (if open-paren-may-be-outside!             (message (concat "Open parenthesis is not found in the region "!                              "restricted by `blink-matching-paren-distance'"))!           (message "Mismatched parentheses")))         ((not blinkpos)          (if (not blink-matching-paren-distance)!             (message "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 open within window, temporarily move to blinkpos but only          ;; if `blink-matching-paren-on-screen' is non-nil.Regards,Guanpeng Xu
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

[-- Attachment #1.2: Type: text/html, Size: 7277 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Not appropriate message for mismatched parens
  2007-04-25 11:01 Not appropriate message for mismatched parens Herbert Euler
@ 2007-04-25 11:13 ` Herbert Euler
  2007-04-25 11:21   ` Herbert Euler
  2007-04-26  0:20 ` Herbert Euler
  2007-04-26  3:06 ` Glenn Morris
  2 siblings, 1 reply; 6+ messages in thread
From: Herbert Euler @ 2007-04-25 11:13 UTC (permalink / raw)
  To: herberteuler, emacs-devel

I am sorry but the following patch is better, because it emphasises
on the situation when setting `open-paren-may-be-outside':

*** simple.el~  Wed Apr 25 18:25:55 2007
--- simple.el   Wed Apr 25 19:05:09 2007
*************** (defun blink-matching-open ()
*** 4483,4495 ****
           blinkpos
           message-log-max  ; Don't log messages about paren matching.
           matching-paren
!          open-paren-line-string)
        (save-excursion
        (save-restriction
!         (if blink-matching-paren-distance
!             (narrow-to-region (max (minibuffer-prompt-end)
!                                    (- (point) 
blink-matching-paren-distance))
!                               oldpos))
          (condition-case ()
              (let ((parse-sexp-ignore-comments
                     (and parse-sexp-ignore-comments
--- 4483,4500 ----
           blinkpos
           message-log-max  ; Don't log messages about paren matching.
           matching-paren
!          open-paren-line-string
!          open-paren-may-be-outside)
        (save-excursion
        (save-restriction
!         (when blink-matching-paren-distance
!           (setq open-paren-may-be-outside
!                 (< (minibuffer-prompt-end)
!                    (- (point) blink-matching-paren-distance)))
!           (if blink-matching-paren-distance
!               (narrow-to-region (max (minibuffer-prompt-end)
!                                      (- (point) 
blink-matching-paren-distance))
!                                 oldpos)))
          (condition-case ()
              (let ((parse-sexp-ignore-comments
                     (and parse-sexp-ignore-comments
*************** (defun blink-matching-open ()
*** 4510,4519 ****
                     ;; 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.
--- 4515,4530 ----
                     ;; a matching-char info, in which case the two CDRs
                     ;; should match.
                     (eq matching-paren (cdr (syntax-after (1- oldpos))))))
!         (if open-paren-may-be-outside
!             (message (concat "Open parenthesis is not found in the region 
"
!                              "restricted by 
`blink-matching-paren-distance'"))
!           (message "Mismatched parentheses")))
         ((not blinkpos)
          (if (not blink-matching-paren-distance)
!             (message "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 open within window, temporarily move to blinkpos but 
only
          ;; if `blink-matching-paren-on-screen' is non-nil.

Regards,
Guanpeng Xu

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Not appropriate message for mismatched parens
  2007-04-25 11:13 ` Herbert Euler
@ 2007-04-25 11:21   ` Herbert Euler
  2007-04-30 22:09     ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Euler @ 2007-04-25 11:21 UTC (permalink / raw)
  To: herberteuler, emacs-devel

Please, please, please forgive me.  I forgot to delete the `if'.
Please check the following patch.

Regards,
Guanpeng Xu

*** simple.el   Wed Apr 25 19:17:01 2007
--- simple.el.modified  Wed Apr 25 19:15:11 2007
*************** (defun blink-matching-open ()
*** 4483,4495 ****
           blinkpos
           message-log-max  ; Don't log messages about paren matching.
           matching-paren
!          open-paren-line-string)
        (save-excursion
        (save-restriction
!         (if blink-matching-paren-distance
!             (narrow-to-region (max (minibuffer-prompt-end)
!                                    (- (point) 
blink-matching-paren-distance))
!                               oldpos))
          (condition-case ()
              (let ((parse-sexp-ignore-comments
                     (and parse-sexp-ignore-comments
--- 4483,4499 ----
           blinkpos
           message-log-max  ; Don't log messages about paren matching.
           matching-paren
!          open-paren-line-string
!          open-paren-may-be-outside)
        (save-excursion
        (save-restriction
!         (when blink-matching-paren-distance
!           (setq open-paren-may-be-outside
!                 (< (minibuffer-prompt-end)
!                    (- (point) blink-matching-paren-distance)))
!           (narrow-to-region (max (minibuffer-prompt-end)
!                                  (- (point) 
blink-matching-paren-distance))
!                             oldpos))
          (condition-case ()
              (let ((parse-sexp-ignore-comments
                     (and parse-sexp-ignore-comments
*************** (defun blink-matching-open ()
*** 4510,4519 ****
                     ;; 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.
--- 4514,4529 ----
                     ;; a matching-char info, in which case the two CDRs
                     ;; should match.
                     (eq matching-paren (cdr (syntax-after (1- oldpos))))))
!         (if open-paren-may-be-outside
!             (message (concat "Open parenthesis is not found in the region 
"
!                              "restricted by 
`blink-matching-paren-distance'"))
!           (message "Mismatched parentheses")))
         ((not blinkpos)
          (if (not blink-matching-paren-distance)
!             (message "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 open within window, temporarily move to blinkpos but 
only
          ;; if `blink-matching-paren-on-screen' is non-nil.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Not appropriate message for mismatched parens
  2007-04-25 11:01 Not appropriate message for mismatched parens Herbert Euler
  2007-04-25 11:13 ` Herbert Euler
@ 2007-04-26  0:20 ` Herbert Euler
  2007-04-26  3:06 ` Glenn Morris
  2 siblings, 0 replies; 6+ messages in thread
From: Herbert Euler @ 2007-04-26  0:20 UTC (permalink / raw)
  To: herberteuler, emacs-devel

It is my responsibility of speaking clearly.  To reproduce the
undesired behavior, follow these steps:

1. Set the value of `blink-matching-paren-distance' to 1.
2. In any buffer that is not read-only, type "()".

The error message "Mismatched parentheses" will be showed.
But the parentheses are in fact matched.

I'm sorry.  I'll state how to reproduce the problem in the
future.

Regards,
Guanpeng Xu

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Not appropriate message for mismatched parens
  2007-04-25 11:01 Not appropriate message for mismatched parens Herbert Euler
  2007-04-25 11:13 ` Herbert Euler
  2007-04-26  0:20 ` Herbert Euler
@ 2007-04-26  3:06 ` Glenn Morris
  2 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2007-04-26  3:06 UTC (permalink / raw)
  To: Herbert Euler; +Cc: emacs-devel

Herbert Euler wrote:

> The variable `blink-matching-paren-distance' limits searching
> regionfor blinking matching parens. However, the error message for
> the casein which the distance between the opening paren and the
> closing parenis larger than `blink-matching-paren-distance' is not
> so veryappropriate. It says "Mismatched parenthesis", just the same
> as forthe normal cases.This may be not the truth in some cases.


While everything you say is true, with the default settings the
parentheses must be separated by > 320 lines of 80 column text for
this problem to occur. I suggest it is therefore acceptable to leave
this as is for Emacs 22, and fix it properly afterwards.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Not appropriate message for mismatched parens
  2007-04-25 11:21   ` Herbert Euler
@ 2007-04-30 22:09     ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2007-04-30 22:09 UTC (permalink / raw)
  To: Herbert Euler; +Cc: herberteuler, emacs-devel

I decided to save this for later.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-04-30 22:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-25 11:01 Not appropriate message for mismatched parens Herbert Euler
2007-04-25 11:13 ` Herbert Euler
2007-04-25 11:21   ` Herbert Euler
2007-04-30 22:09     ` Richard Stallman
2007-04-26  0:20 ` Herbert Euler
2007-04-26  3:06 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).