diff --git a/configuration.org b/configuration.org index 0174ec4c02b3bf7a31a4e2b95df2e80158382c41..85694a23f92c7fc9636d2cf106d28b74b65ea250 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