From 8a028d54dd3e694e0497cea2ba3c34d02d37aa16 Mon Sep 17 00:00:00 2001 From: John Turner Date: Tue, 4 Oct 2022 22:32:18 -0400 Subject: [PATCH] removed display-buffer-alist update function Before we had a function that updated display-buffer-alist whenever the frame's size was changed, so that info windows like flymake or flycheck open would snap to either the bottom or right hand side of the frame depending on whether the window manager had the frame squeezed vertically (like when you have two windows side by side split vertically). Now instead of having that function run every time the frame resizes, we just make the 'side property a function that should get evaluated each time the property is read. The function returns either 'bottom or 'right depending on the frame's current size in pixels. --- .../config-display-buffer-alist.el | 17 ----------------- config/flycheck/config-flycheck.el | 8 +++++++- config/flymake/config-flymake.el | 6 ++++++ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/config/display-buffer/config-display-buffer-alist.el b/config/display-buffer/config-display-buffer-alist.el index caf2229..e64f109 100644 --- a/config/display-buffer/config-display-buffer-alist.el +++ b/config/display-buffer/config-display-buffer-alist.el @@ -4,20 +4,3 @@ (if (> (+ (frame-pixel-width) config-display-buffer-gaps-width) (/ (x-display-pixel-width) 2)) 'right 'bottom)) - -(defun config-display-buffer-update-alist (_) - (let ((side (config-display-buffer-which-side))) - (setq display-buffer-alist `(("\\*Flymake diagnostics.*" - (display-buffer-in-side-window) - (side . ,side) - (window-height . 15) - (window-width . 75) - ("\*Flycheck errors\*" - (display-buffer-in-side-window) - (side . ,side) - (window-height . 15) - (window-width . 75))))))) - -(add-hook 'after-make-frame-functions 'config-display-buffer-update-alist) - -(add-hook 'window-size-change-functions 'config-display-buffer-update-alist) diff --git a/config/flycheck/config-flycheck.el b/config/flycheck/config-flycheck.el index 7478606..0c1ae1b 100644 --- a/config/flycheck/config-flycheck.el +++ b/config/flycheck/config-flycheck.el @@ -1,7 +1,13 @@ (require 'flycheck) +(load "config-flycheck-cargo-has-command-p-fix") + (add-hook 'flycheck-error-list-mode-hook (lambda () (visual-line-mode 1))) -(load "config-flycheck-cargo-has-command-p-fix") +(add-to-list 'display-buffer-alist '("\\*Flycheck errors.*" + (display-buffer-in-side-window) + (side . (config-display-buffer-which-side)) + (window-height . 15) + (window-width . 75))) (provide 'config-flycheck) diff --git a/config/flymake/config-flymake.el b/config/flymake/config-flymake.el index 203e52b..c691bee 100644 --- a/config/flymake/config-flymake.el +++ b/config/flymake/config-flymake.el @@ -2,4 +2,10 @@ (load "config-flymake-hooks") +(add-to-list 'display-buffer-alist '("\\*Flymake diagnostics.*" + (display-buffer-in-side-window) + (side . (config-display-buffer-which-side)) + (window-height . 15) + (window-width . 75))) + (provide 'config-flymake)