diff --git a/config/display-buffer/config-display-buffer-alist.el b/config/display-buffer/config-display-buffer-alist.el deleted file mode 100644 index e64f109..0000000 --- a/config/display-buffer/config-display-buffer-alist.el +++ /dev/null @@ -1,6 +0,0 @@ -(defvar config-display-buffer-gaps-width 20) - -(defun config-display-buffer-which-side () - (if (> (+ (frame-pixel-width) config-display-buffer-gaps-width) (/ (x-display-pixel-width) 2)) - 'right - 'bottom)) diff --git a/config/display-buffer/config-display-buffer-best-side.el b/config/display-buffer/config-display-buffer-best-side.el new file mode 100644 index 0000000..9a2ff48 --- /dev/null +++ b/config/display-buffer/config-display-buffer-best-side.el @@ -0,0 +1,7 @@ +(defun config-display-buffer-frame-wide-p () + (> (frame-pixel-width) (/ (x-display-pixel-width) 2))) + +(defun config-display-buffer-best-side (buffer alist) + (let* ((side (funcall (alist-get 'which-side alist))) + (alist (append (cdr alist) (list (cons 'side side))))) + (display-buffer-in-side-window buffer alist))) diff --git a/config/display-buffer/config-display-buffer.el b/config/display-buffer/config-display-buffer.el index c36d35f..022b1df 100644 --- a/config/display-buffer/config-display-buffer.el +++ b/config/display-buffer/config-display-buffer.el @@ -1,5 +1,5 @@ (setq display-buffer-base-action '(display-buffer-same-window display-buffer-reuse-window)) -(load "config-display-buffer-alist") +(load "config-display-buffer-best-side") (provide 'config-display-buffer) diff --git a/config/flycheck/config-flycheck.el b/config/flycheck/config-flycheck.el index 0c1ae1b..95c0b49 100644 --- a/config/flycheck/config-flycheck.el +++ b/config/flycheck/config-flycheck.el @@ -5,9 +5,11 @@ (add-hook 'flycheck-error-list-mode-hook (lambda () (visual-line-mode 1))) (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))) + (config-display-buffer-best-side) + (which-side . (lambda () + (if (config-display-buffer-frame-wide-p) + 'right + 'bottom))))) + (provide 'config-flycheck) diff --git a/config/flymake/config-flymake.el b/config/flymake/config-flymake.el index c691bee..c9a3dfe 100644 --- a/config/flymake/config-flymake.el +++ b/config/flymake/config-flymake.el @@ -3,9 +3,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))) + (config-display-buffer-best-side) + (which-side . (lambda () + (if (config-display-buffer-frame-wide-p) + 'right + 'bottom))))) (provide 'config-flymake)