summaryrefslogtreecommitdiff
path: root/lisp/paren.el
diff options
context:
space:
mode:
authorBastien Guerry <bzg@gnu.org>2013-01-23 10:43:29 +0100
committerBastien Guerry <bzg@gnu.org>2013-01-23 10:43:29 +0100
commitd6f9c03fbb8ae9a268bf6c8ab9651d9c831e8865 (patch)
treed56495a30c5f583a0ea20113233c4949bd0c8b37 /lisp/paren.el
parent3544e11a3490b7d753451ad394ef6285a9dc4f98 (diff)
downloademacs-d6f9c03fbb8ae9a268bf6c8ab9651d9c831e8865.tar.gz
* paren.el (show-paren-function): Make sure an overlay exists
before trying to delete it. Also use `pos' as a position only when it is an integer. See this thread: http://thread.gmane.org/gmane.emacs.devel/156498
Diffstat (limited to 'lisp/paren.el')
-rw-r--r--lisp/paren.el30
1 files changed, 15 insertions, 15 deletions
diff --git a/lisp/paren.el b/lisp/paren.el
index b87c8bde89a..bf2238d4907 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -243,23 +243,23 @@ matching parenthesis is highlighted in `show-paren-style' after
;;
;; Turn on highlighting for the matching paren, if found.
;; If it's an unmatched paren, turn off any such highlighting.
- (unless (integerp pos)
- (delete-overlay show-paren-overlay))
- (let ((to (if (or (eq show-paren-style 'expression)
- (and (eq show-paren-style 'mixed)
- (not (pos-visible-in-window-p pos))))
- (point)
- pos))
- (from (if (or (eq show-paren-style 'expression)
+ (if (not (integerp pos))
+ (when show-paren-overlay (delete-overlay show-paren-overlay))
+ (let ((to (if (or (eq show-paren-style 'expression)
(and (eq show-paren-style 'mixed)
(not (pos-visible-in-window-p pos))))
- pos
- (save-excursion
- (goto-char pos)
- (- (point) dir)))))
- (if show-paren-overlay
- (move-overlay show-paren-overlay from to (current-buffer))
- (setq show-paren-overlay (make-overlay from to nil t))))
+ (point)
+ pos))
+ (from (if (or (eq show-paren-style 'expression)
+ (and (eq show-paren-style 'mixed)
+ (not (pos-visible-in-window-p pos))))
+ pos
+ (save-excursion
+ (goto-char pos)
+ (- (point) dir)))))
+ (if show-paren-overlay
+ (move-overlay show-paren-overlay from to (current-buffer))
+ (setq show-paren-overlay (make-overlay from to nil t)))))
;;
;; Always set the overlay face, since it varies.
(overlay-put show-paren-overlay 'priority show-paren-priority)