branch: externals/dired-preview commit 18b607fc4835f2263701bd8b08fa8ae02dd79206 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Simplify dired-preview-return-window-size I was wrong about the FIXME I mentioned in commit 959299b, regarding the calculation of the height. What I should have noted is that we could not predict its value. --- dired-preview.el | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/dired-preview.el b/dired-preview.el index 0983f6a380..11040ab4c3 100644 --- a/dired-preview.el +++ b/dired-preview.el @@ -179,17 +179,12 @@ DIMENSION is either a `:width' or `:height' keyword. It is checked against `split-width-threshold' or `split-height-threshold'" (pcase dimension - ;; FIXME 2023-07-03: In both cases, this assumes that the "else" - ;; result is smaller than the "then". This is not a given though, - ;; because we do not know the result of the calculation ahead of - ;; time. - (:width (if (>= (* fill-column 2) split-width-threshold) - fill-column - (- (window-body-width) fill-column))) - (:height (let ((height (frame-height))) - (if (>= (* height 2) split-height-threshold) - height - (- (window-body-height) height)))))) + (:width (if (and (numberp split-width-threshold) + (> (window-width) split-width-threshold) + (> split-width-threshold fill-column)) + split-width-threshold + fill-column)) + (:height (floor split-height-threshold 2)))) (defun dired-preview-display-action-side () "Pick a side window that is appropriate for the given frame."