Skip to content

Commit

Permalink
Only dedicate compilation buffer if it is being displayed
Browse files Browse the repository at this point in the history
Fixes #186.

When the compilation buffer is not displayed at the time `next-error`
is invoked, then `compilation-window` ends up nil, and
`window-dedicated-p` and `set-window-dedicated-p` end up operating on
whatever window happens to be selected.

This ends up being two different windows if `next-error` moves to a
different buffer, and so the dedicated-ness of the windows is not
correctly preserved.

Fix by only attempting to make the window dedicated if
`compilation-window` is non-nil.
  • Loading branch information
bcc32 committed Apr 21, 2021
1 parent dc4f8a0 commit 059af61
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions window-purpose-fixes.el
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ duration of the function."

(let* ((compilation-window (get-buffer-window (marker-buffer (point-marker))))
(old-window-dedicated-p (window-dedicated-p compilation-window)))
(set-window-dedicated-p compilation-window t)
(unwind-protect
(if (not compilation-window)
(apply oldfun args)
(set-window-dedicated-p compilation-window old-window-dedicated-p))))
(set-window-dedicated-p compilation-window t)
(unwind-protect
(apply oldfun args)
(set-window-dedicated-p compilation-window old-window-dedicated-p)))))

(purpose-fix-install-advice-toggler
#'compilation-next-error-function
Expand Down

0 comments on commit 059af61

Please sign in to comment.