From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#9461: 24.0.50; Weird behaviour in "show-parent-mode" Date: Fri, 09 Sep 2011 12:54:21 +0300 Organization: JURTA Message-ID: <87wrdi82qm.fsf@mail.jurta.org> References: <87pqjbq4zd.fsf@mail.jurta.org> <87bouuu8tw.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1315562294 32419 80.91.229.12 (9 Sep 2011 09:58:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Sep 2011 09:58:14 +0000 (UTC) Cc: 9461@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 09 11:58:10 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R1xqX-0006eP-Gr for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Sep 2011 11:58:05 +0200 Original-Received: from localhost ([::1]:58441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1xqU-00068W-CE for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Sep 2011 05:58:02 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1xqS-00068D-5V for bug-gnu-emacs@gnu.org; Fri, 09 Sep 2011 05:58:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1xqR-0003d2-49 for bug-gnu-emacs@gnu.org; Fri, 09 Sep 2011 05:58:00 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1xqR-0003cy-2c for bug-gnu-emacs@gnu.org; Fri, 09 Sep 2011 05:57:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R1xuM-00024H-1L; Fri, 09 Sep 2011 06:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Sep 2011 10:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9461 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9461-submit@debbugs.gnu.org id=B9461.13155624957909 (code B ref 9461); Fri, 09 Sep 2011 10:02:01 +0000 Original-Received: (at 9461) by debbugs.gnu.org; 9 Sep 2011 10:01:35 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R1xtt-00023R-NF for submit@debbugs.gnu.org; Fri, 09 Sep 2011 06:01:34 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R1xtr-00023I-Dn for 9461@debbugs.gnu.org; Fri, 09 Sep 2011 06:01:32 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id F16036E8055; Fri, 9 Sep 2011 02:57:26 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id E114E451C461; Fri, 9 Sep 2011 02:57:25 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Thu, 08 Sep 2011 22:32:37 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 09 Sep 2011 06:02:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50755 Archived-At: >> Perhaps nothing should be highlighted when syntax of the previous >> character is `escape' `\'. > > I think show-paren-mode should at least follow the same heuristic as the > default blink-paren behavior, which indeed refrains from blinking the > "open paren" when the close-paren is escaped. I verified that the following patch provides this result: === modified file 'lisp/paren.el' --- lisp/paren.el 2011-01-25 04:08:28 +0000 +++ lisp/paren.el 2011-09-09 09:46:03 +0000 @@ -135,13 +135,23 @@ (define-minor-mode show-paren-mode ;; and show it until input arrives. (defun show-paren-function () (if show-paren-mode - (let ((oldpos (point)) + (let* ((oldpos (point)) (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1) ((eq (syntax-class (syntax-after (point))) 4) 1))) + (unescaped + (when dir + ;; Verify an even number of quoting characters precede the paren. + ;; Follow the same logic as in `blink-matching-open'. + (= (if (= dir -1) 1 0) + (logand 1 (- (point) + (save-excursion + (if (= dir -1) (forward-char -1)) + (skip-syntax-backward "/\\") + (point))))))) pos mismatch face) ;; ;; Find the other end of the sexp. - (when dir + (when unescaped (save-excursion (save-restriction ;; Determine the range within which to look for a match. BTW, I don't understand one comment about escaped parens in `show-paren-function': ;; Move back the other way and verify we get back to the ;; starting point. If not, these two parens don't really match. ;; Maybe the one at point is escaped and doesn't really count. It seems irrelevant to the current problem.