Skip to content

Commit 4347846

Browse files
committed
Make compilation hook buffer local
1 parent fd1aa58 commit 4347846

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

dap-mode.el

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,16 +1695,17 @@ be used to compile the project, spin up docker, ...."
16951695
"*DAP compilation*"))
16961696
(let (window)
16971697
(cl-labels ((cf (buf status &rest _)
1698-
(remove-hook 'compilation-finish-functions #'cf)
1699-
(if (string= "finished\n" status)
1700-
(progn
1701-
(when (and (not dap-debug-compilation-keep)
1702-
(window-live-p window)
1703-
(eq buf (window-buffer window)))
1704-
(delete-window window))
1705-
(funcall cb))
1706-
(lsp--error "Compilation step failed"))))
1707-
(add-hook 'compilation-finish-functions #'cf)
1698+
(with-current-buffer buf
1699+
(remove-hook 'compilation-finish-functions #'cf t)
1700+
(if (string= "finished\n" status)
1701+
(progn
1702+
(when (and (not dap-debug-compilation-keep)
1703+
(window-live-p window)
1704+
(eq buf (window-buffer window)))
1705+
(delete-window window))
1706+
(funcall cb))
1707+
(lsp--error "Compilation step failed")))))
1708+
(add-hook 'compilation-finish-functions #'cf nil t)
17081709
(setq window (display-buffer (current-buffer)))))))
17091710
(funcall cb))))
17101711

0 commit comments

Comments
 (0)