diff options
| author | Bastien Guerry | 2013-01-23 10:43:29 +0100 |
|---|---|---|
| committer | Bastien Guerry | 2013-01-23 10:43:29 +0100 |
| commit | d6f9c03fbb8ae9a268bf6c8ab9651d9c831e8865 (patch) | |
| tree | d56495a30c5f583a0ea20113233c4949bd0c8b37 | |
| parent | 3544e11a3490b7d753451ad394ef6285a9dc4f98 (diff) | |
| download | emacs-d6f9c03fbb8ae9a268bf6c8ab9651d9c831e8865.tar.gz emacs-d6f9c03fbb8ae9a268bf6c8ab9651d9c831e8865.zip | |
* 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
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/paren.el | 30 |
2 files changed, 21 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3797a87751d..d783443f528 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-01-23 Bastien Guerry <bzg@gnu.org> | ||
| 2 | |||
| 3 | * paren.el (show-paren-function): Make sure an overlay exists | ||
| 4 | before trying to delete it. Also use `pos' as a position only | ||
| 5 | when it is an integer. | ||
| 6 | |||
| 1 | 2013-01-23 Dmitry Antipov <dmantipov@yandex.ru> | 7 | 2013-01-23 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 8 | ||
| 3 | * play/gametree.el (gametree-break-line-here): Use point-marker. | 9 | * play/gametree.el (gametree-break-line-here): Use point-marker. |
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 | |||
| 243 | ;; | 243 | ;; |
| 244 | ;; Turn on highlighting for the matching paren, if found. | 244 | ;; Turn on highlighting for the matching paren, if found. |
| 245 | ;; If it's an unmatched paren, turn off any such highlighting. | 245 | ;; If it's an unmatched paren, turn off any such highlighting. |
| 246 | (unless (integerp pos) | 246 | (if (not (integerp pos)) |
| 247 | (delete-overlay show-paren-overlay)) | 247 | (when show-paren-overlay (delete-overlay show-paren-overlay)) |
| 248 | (let ((to (if (or (eq show-paren-style 'expression) | 248 | (let ((to (if (or (eq show-paren-style 'expression) |
| 249 | (and (eq show-paren-style 'mixed) | ||
| 250 | (not (pos-visible-in-window-p pos)))) | ||
| 251 | (point) | ||
| 252 | pos)) | ||
| 253 | (from (if (or (eq show-paren-style 'expression) | ||
| 254 | (and (eq show-paren-style 'mixed) | 249 | (and (eq show-paren-style 'mixed) |
| 255 | (not (pos-visible-in-window-p pos)))) | 250 | (not (pos-visible-in-window-p pos)))) |
| 256 | pos | 251 | (point) |
| 257 | (save-excursion | 252 | pos)) |
| 258 | (goto-char pos) | 253 | (from (if (or (eq show-paren-style 'expression) |
| 259 | (- (point) dir))))) | 254 | (and (eq show-paren-style 'mixed) |
| 260 | (if show-paren-overlay | 255 | (not (pos-visible-in-window-p pos)))) |
| 261 | (move-overlay show-paren-overlay from to (current-buffer)) | 256 | pos |
| 262 | (setq show-paren-overlay (make-overlay from to nil t)))) | 257 | (save-excursion |
| 258 | (goto-char pos) | ||
| 259 | (- (point) dir))))) | ||
| 260 | (if show-paren-overlay | ||
| 261 | (move-overlay show-paren-overlay from to (current-buffer)) | ||
| 262 | (setq show-paren-overlay (make-overlay from to nil t))))) | ||
| 263 | ;; | 263 | ;; |
| 264 | ;; Always set the overlay face, since it varies. | 264 | ;; Always set the overlay face, since it varies. |
| 265 | (overlay-put show-paren-overlay 'priority show-paren-priority) | 265 | (overlay-put show-paren-overlay 'priority show-paren-priority) |