From c371bfe06ab22698da3078af7cd84ed286e61819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hauspie?= <michael.hauspie@univ-lille.fr> Date: Tue, 25 Feb 2025 10:24:09 +0100 Subject: [PATCH] Add tweaks to compile window --- configuration.org | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/configuration.org b/configuration.org index 0174ec4..85694a2 100644 --- a/configuration.org +++ b/configuration.org @@ -826,10 +826,29 @@ information from a language server dedicated to the programming language currently in use. First, configure the compilation buffer so that it scrolls to the end or to the first encountered -error if any +error if any and sets its height. #+begin_src emacs-lisp (setq compilation-scroll-output 'first-error) +(setq compilation-window-height 15) +(defun my-select-bottom-window () + (let ((bottom-window (selected-window)) + window-below) + (while (setq window-below (window-in-direction 'below bottom-window)) + (setq bottom-window window-below)) + (select-window bottom-window))) + +(defun my-compilation-hook () + (when (not (get-buffer-window "*compilation*")) + (save-selected-window + (save-excursion + (my-select-bottom-window) + (let* ((w (split-window-vertically)) + (h (window-height w))) + (select-window w) + (switch-to-buffer "*compilation*") + (shrink-window (- h compilation-window-height))))))) +(add-hook 'compilation-mode-hook 'my-compilation-hook) #+end_src ** LSP -- GitLab