dgutov pushed a commit to branch master
in repository elpa.
commit f07dfa2c49ed07a28914c69d36748295760034b5
Author: Le Wang <[email protected]>
Date: Thu Jul 10 10:43:16 2014 -0400
Check if buffer is alive before reparsing.
---
js2-mode.el | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index 2b37a7f..649d558 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -10522,13 +10522,14 @@ Selecting an error will jump it to the corresponding
source-buffer error.
(defun js2-mode-idle-reparse (buffer)
"Run `js2-reparse' if BUFFER is the current buffer, or schedule
it to be reparsed when the buffer is selected."
- (if (eq buffer (current-buffer))
- (js2-reparse)
- ;; reparse when the buffer is selected again
- (with-current-buffer buffer
- (add-hook 'window-configuration-change-hook
- #'js2-mode-idle-reparse-inner
- nil t))))
+ (cond ((eq buffer (current-buffer))
+ (js2-reparse))
+ ((buffer-live-p buffer)
+ ;; reparse when the buffer is selected again
+ (with-current-buffer buffer
+ (add-hook 'window-configuration-change-hook
+ #'js2-mode-idle-reparse-inner
+ nil t)))))
(defun js2-mode-idle-reparse-inner ()
(remove-hook 'window-configuration-change-hook