Commit 4a608e2aaa26

Vincent Demeester <vincent@sbr.pm>
2019-11-08 18:02:35
setup-compile.el: mark compilation buffer's windows as dedicated
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 1d19c33
Changed files (1)
lisp/setup-compile.el
@@ -26,7 +26,19 @@
       (unless (or (derived-mode-p 'grep-mode) ;Don't mess up colors in Grep/Ag results buffers
                   (derived-mode-p 'ag-mode))
         (ansi-color-apply-on-region compilation-filter-start (point))))
-    (add-hook 'compilation-filter-hook #'vde/colorize-compilation-buffer)))
+    (add-hook 'compilation-filter-hook #'vde/colorize-compilation-buffer)
+    
+    (defun vde/mark-compilation-window-as-dedicated ()
+      "Setup the *compilation* window with custom settings."
+      (when (string-prefix-p "*compilation: " (buffer-name))
+        (save-selected-window
+          (save-excursion
+            (let* ((w (get-buffer-window (buffer-name))))
+              (when w
+                (select-window w)
+                (switch-to-buffer (buffer-name))
+                (set-window-dedicated-p w t)))))))
+    (add-hook 'compilation-mode-hook 'vde/mark-compilation-window-as-dedicated)))
 
 (use-package flycheck
   :if (not (eq system-type 'windows-nt))