summaryrefslogtreecommitdiff
path: root/lisp/paren.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2011-09-10 14:28:19 +0300
committerJuri Linkov <juri@jurta.org>2011-09-10 14:28:19 +0300
commit056e44efe83c4740668f631372a2a87169ea0133 (patch)
treecbe200e76449b8cf1ae1717691a8cae0814c1cfa /lisp/paren.el
parentc3760c17bd1d2b81a05c50c1b1f7236fc34adb33 (diff)
downloademacs-056e44efe83c4740668f631372a2a87169ea0133.tar.gz
* lisp/paren.el (show-paren-function): Don't show escaped parens.
Let-bind `unescaped' to `t' when paren is not escaped. Fixes: debbugs:9461
Diffstat (limited to 'lisp/paren.el')
-rw-r--r--lisp/paren.el20
1 files changed, 15 insertions, 5 deletions
diff --git a/lisp/paren.el b/lisp/paren.el
index 8bd96b9317a..fb5c0bf36e9 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -135,13 +135,23 @@ in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time."
;; and show it until input arrives.
(defun show-paren-function ()
(if show-paren-mode
- (let ((oldpos (point))
- (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1)
- ((eq (syntax-class (syntax-after (point))) 4) 1)))
- pos mismatch face)
+ (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.