]> git.eshelyaron.com Git - emacs.git/commitdiff
Protect compilation-auto-jump against code killing the buffer
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 5 Sep 2020 12:31:52 +0000 (14:31 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 5 Sep 2020 12:31:52 +0000 (14:31 +0200)
* lisp/progmodes/compile.el (compilation-auto-jump): Something may
have killed the buffer before the timer fired (bug#24585).

lisp/progmodes/compile.el

index 0dedde3d019c6383de244c30ca37228670d65613..1b1920bf1954828c6bf9fa3b9e922044bc537eca 100644 (file)
@@ -1148,12 +1148,13 @@ POS and RES.")
            (setcdr l1 (cons (list ,key) l2)))))))
 
 (defun compilation-auto-jump (buffer pos)
-  (with-current-buffer buffer
-    (goto-char pos)
-    (let ((win (get-buffer-window buffer 0)))
-      (if win (set-window-point win pos)))
-    (if compilation-auto-jump-to-first-error
-       (compile-goto-error))))
+  (when (buffer-live-p buffer)
+    (with-current-buffer buffer
+      (goto-char pos)
+      (let ((win (get-buffer-window buffer 0)))
+        (if win (set-window-point win pos)))
+      (if compilation-auto-jump-to-first-error
+         (compile-goto-error)))))
 
 ;; This function is the central driver, called when font-locking to gather
 ;; all information needed to later jump to corresponding source code.