From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 9461@debbugs.gnu.org
Subject: bug#9461: 24.0.50; Weird behaviour in "show-parent-mode"
Date: Fri, 09 Sep 2011 12:54:21 +0300 [thread overview]
Message-ID: <87wrdi82qm.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwv62l2v45m.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 08 Sep 2011 22:32:37 -0400")
>> 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.
next prev parent reply other threads:[~2011-09-09 9:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-07 17:21 bug#9461: 24.0.50; Weird behaviour in "show-parent-mode" Dani Moncayo
2011-09-07 20:39 ` Andreas Schwab
2011-09-07 20:53 ` Dani Moncayo
2011-09-07 23:06 ` Andreas Schwab
2011-09-07 23:59 ` Juri Linkov
2011-09-08 8:14 ` Dani Moncayo
2011-09-08 10:42 ` Dani Moncayo
2011-09-08 19:54 ` Juri Linkov
2011-09-09 2:32 ` Stefan Monnier
2011-09-09 9:54 ` Juri Linkov [this message]
2011-09-09 11:01 ` Dani Moncayo
2011-09-09 11:38 ` Dani Moncayo
2011-09-09 14:17 ` Stefan Monnier
2011-09-09 15:01 ` Juri Linkov
2011-09-09 21:45 ` Stefan Monnier
2011-09-10 11:28 ` Juri Linkov
2011-09-09 6:26 ` martin rudalics
2011-09-09 9:55 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wrdi82qm.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=9461@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).