diff options
author | Pierre Courtieu <Pierre.Courtieu@cnam.fr> | 2015-11-13 15:14:06 +0100 |
---|---|---|
committer | Pierre Courtieu <Pierre.Courtieu@cnam.fr> | 2015-11-13 15:14:06 +0100 |
commit | 078e38fb576dbd91fb92b7bca89d4a9d47f88e79 (patch) | |
tree | f8d5890e11e3f3c2e82f9e74e6c30f15b8349d79 /generic | |
parent | 94499e1d47e93e6bcfecce7b23525b34ff083c32 (diff) |
Cleaning code for auto width adapting.
Less guessing, separate guessing code.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/pg-response.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/generic/pg-response.el b/generic/pg-response.el index e278cec3..e903858e 100644 --- a/generic/pg-response.el +++ b/generic/pg-response.el @@ -130,6 +130,18 @@ Internal variable, setting this will have no effect!") (defun proof-three-window-enable () (proof-layout-windows)) + +(defun proof-guess-3win-display-policy (&optional policy) + "Return the 3 windows mode layout policy from user choice POLICY. +If POLIY is smart then guess the good policy from the current +frame geometry, otherwise follow POLICY." + (if (eq policy 'smart) + (cond + ((>= (frame-width) (* 1.5 split-width-threshold)) 'horizontal) + ((>= (frame-width) split-width-threshold) 'hybrid) + (t 'vertical)) + policy)) + (defun proof-select-three-b (b1 b2 b3 &optional policy) "Put the given three buffers into three windows. Following POLICY, which can be one of 'smart, 'horizontal, @@ -137,15 +149,7 @@ Following POLICY, which can be one of 'smart, 'horizontal, (interactive "bBuffer1:\nbBuffer2:\nbBuffer3:") (delete-other-windows) (switch-to-buffer b1) - (let ((pol)) - (if (eq policy 'smart) - (cond - ((>= (frame-width) (* 1.5 split-width-threshold)) - (setq pol 'horizontal)) - ((>= (frame-width) split-width-threshold) - (setq pol 'hybrid)) - (t (setq pol 'vertical))) - (setq pol policy)) + (let ((pol (proof-guess-3win-display-policy policy))) (save-selected-window (cond ((eq pol 'hybrid) |