[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9461: 24.0.50; Weird behaviour in "show-parent-mode"
From: |
Juri Linkov |
Subject: |
bug#9461: 24.0.50; Weird behaviour in "show-parent-mode" |
Date: |
Fri, 09 Sep 2011 12:54:21 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) |
>> 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.
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Dani Moncayo, 2011/09/07
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Andreas Schwab, 2011/09/07
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Juri Linkov, 2011/09/07
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Dani Moncayo, 2011/09/08
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Dani Moncayo, 2011/09/08
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Juri Linkov, 2011/09/08
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Stefan Monnier, 2011/09/08
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode",
Juri Linkov <=
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Dani Moncayo, 2011/09/09
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Dani Moncayo, 2011/09/09
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Stefan Monnier, 2011/09/09
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Juri Linkov, 2011/09/09
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Stefan Monnier, 2011/09/09
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Juri Linkov, 2011/09/10
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", martin rudalics, 2011/09/09
- bug#9461: 24.0.50; Weird behaviour in "show-parent-mode", Juri Linkov, 2011/09/09