]> git.eshelyaron.com Git - emacs.git/commitdiff
* paren.el (show-paren-function): Make sure an overlay exists
authorBastien Guerry <bzg@gnu.org>
Wed, 23 Jan 2013 09:43:29 +0000 (10:43 +0100)
committerBastien Guerry <bzg@gnu.org>
Wed, 23 Jan 2013 09:43:29 +0000 (10:43 +0100)
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

lisp/ChangeLog
lisp/paren.el

index 3797a87751dfbff1e171b985dd59c57437cff92d..d783443f5289115580a914bd984e87670642f440 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-23  Bastien Guerry  <bzg@gnu.org>
+
+       * 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.
+
 2013-01-23  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * play/gametree.el (gametree-break-line-here): Use point-marker.
index b87c8bde89aa72a4fb38daecd4b8428e6578f4c9..bf2238d4907b48f9d30dfb80cc2f6eb35946f9fb 100644 (file)
@@ -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)