aboutsummaryrefslogtreecommitdiff
path: root/bard-elisp/bard-window.el
diff options
context:
space:
mode:
authorbard <[email protected]>2024-03-17 21:16:48 -0400
committerbard <[email protected]>2024-03-17 21:16:48 -0400
commite0fc689e4a69e6786586fee7a7d5da36c0411108 (patch)
tree63065c051d5d0bfee17331dbb1a55f7145c3f067 /bard-elisp/bard-window.el
parent8798d136d12714fd5b2167b472e33a3a93a6a573 (diff)
finish copying pop code
Diffstat (limited to 'bard-elisp/bard-window.el')
-rw-r--r--bard-elisp/bard-window.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/bard-elisp/bard-window.el b/bard-elisp/bard-window.el
index e98e364..8860310 100644
--- a/bard-elisp/bard-window.el
+++ b/bard-elisp/bard-window.el
@@ -1,3 +1,24 @@
+(defvar prot-window-window-sizes
+ '( :max-height (lambda () (floor (frame-height) 3))
+ :min-height 10
+ :max-width (lambda () (floor (frame-width) 4))
+ :min-width 20)
+ "Property list of maximum and minimum window sizes.
+The property keys are `:max-height', `:min-height', `:max-width',
+and `:min-width'. They all accept a value of either a
+number (integer or floating point) or a function.")
+
+(defun prot-window--get-window-size (key)
+ "Extract the value of KEY from `prot-window-window-sizes'."
+ (when-let ((value (plist-get prot-window-window-sizes key)))
+ (cond
+ ((functionp value)
+ (funcall value))
+ ((numberp value)
+ value)
+ (t
+ (error "The value of `%s' is neither a number nor a function" key)))))
+
(defun prot-window-select-fit-size (window)
"Select WINDOW and resize it.
The resize pertains to the maximum and minimum values for height