From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: [jbw@macs.hw.ac.uk: parentheses matching failure on valid sexp] Date: Thu, 13 Sep 2007 11:22:52 +0200 Message-ID: <46E9016C.9010706@gmx.at> References: <46E803E9.4000300@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000101070309010600020208" X-Trace: sea.gmane.org 1189675481 29920 80.91.229.12 (13 Sep 2007 09:24:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 Sep 2007 09:24:41 +0000 (UTC) Cc: jbw@macs.hw.ac.uk, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 13 11:24:37 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 1IVkw4-0006wT-Dl for ged-emacs-devel@m.gmane.org; Thu, 13 Sep 2007 11:24:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVkw3-0003Yw-QF for ged-emacs-devel@m.gmane.org; Thu, 13 Sep 2007 05:24:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IVkvy-0003WF-EE for emacs-devel@gnu.org; Thu, 13 Sep 2007 05:24:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IVkvv-0003Sd-UB for emacs-devel@gnu.org; Thu, 13 Sep 2007 05:24:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVkvv-0003SI-De for emacs-devel@gnu.org; Thu, 13 Sep 2007 05:24:23 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IVkvu-00053K-VM for emacs-devel@gnu.org; Thu, 13 Sep 2007 05:24:23 -0400 Original-Received: (qmail invoked by alias); 13 Sep 2007 09:24:20 -0000 Original-Received: from N750P010.adsl.highway.telekom.at (EHLO [62.47.37.170]) [62.47.37.170] by mail.gmx.net (mp028) with SMTP; 13 Sep 2007 11:24:20 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/CF3oVc1fCwzBSEZRh47kvAEZD0wTptgEkkGVN7M 97RRmOOKwX3/4P User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: X-Y-GMX-Trusted: 0 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) 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:78760 Archived-At: This is a multi-part message in MIME format. --------------000101070309010600020208 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > It looks right. Please install. It was too simplistic. In fact I have to distinguish two cases when `blink-matching-paren-distance' is non-nil: - `point-min' is at most `blink-matching-paren-distance' characters before `point'. If in this case I don't find a matching paren there cannot be any such paren and I should treat this case just as with `blink-matching-paren-distance' nil. - `point-min' is more than `blink-matching-paren-distance' characters before `point'. If I don't find a matching paren now there could still be one before the start of the narrowed region. In this case I'd have to display a different message (or maybe no message at all). See the attached patch. --------------000101070309010600020208 Content-Type: text/plain; name="simple.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="simple.patch" *** simple.el.~1.859.2.8.~ Sun Aug 26 22:26:46 2007 --- simple.el Thu Sep 13 10:58:10 2007 *************** *** 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 ! old-start ! new-start) (save-excursion (save-restriction ! (when blink-matching-paren-distance ! (setq old-start (minibuffer-prompt-end)) ! (setq new-start ! (max old-start (- (point) blink-matching-paren-distance))) ! (when (> new-start old-start) ! (narrow-to-region new-start oldpos))) (condition-case () (let ((parse-sexp-ignore-comments (and parse-sexp-ignore-comments *************** *** 4505,4519 **** (eq (syntax-class syntax) 4) (cdr syntax))))) (cond ((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)))))) (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. --- 4509,4526 ---- (eq (syntax-class syntax) 4) (cdr syntax))))) (cond + ((not blinkpos) + (if (and blink-matching-paren-distance (> new-start old-start)) + ;; When `blink-matching-paren-distance' is non-nil and we + ;; narrowed the buffer display more suitable message. + (message "No matching parenthesis found") + (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)))))) (message "Mismatched parentheses")) ((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. --------------000101070309010600020208 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 --------------000101070309010600020208--