diff --git a/lisp/window.el b/lisp/window.el index dd297a3169..5643fb9af3 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7245,8 +7245,12 @@ window--display-buffer (let* ((frame (window-frame window)) (quit-restore (window-parameter window 'quit-restore)) (window-height (assq 'window-height alist)) + (min-height (or (cdr (assq 'window-min-height alist)) + window-min-height)) (height (cdr window-height)) (window-width (assq 'window-width alist)) + (min-width (or (cdr (assq 'window-min-width alist)) + window-min-width)) (width (cdr window-width)) (window-size (assq 'window-size alist)) (size (cdr window-size)) @@ -7300,26 +7304,31 @@ window--display-buffer (setq resize-temp-buffer-window-inhibit 'vertical))) ((numberp height) (let* ((new-height - (if (integerp height) - height - (round - (* (window-total-height (frame-root-window window)) - height)))) + (max (if (integerp height) + height + (round + (* (window-total-height (frame-root-window window)) + height))) + min-height)) (delta (- new-height (window-total-height window)))) (when (and (window--resizable-p window delta nil 'safe) (window-combined-p window)) (window-resize window delta nil 'safe))) (setq resize-temp-buffer-window-inhibit 'vertical)) ((and (consp height) (eq (car height) 'body-lines)) - (let* ((delta (- (* (frame-char-height frame) (cdr height)) - (window-body-height window t)))) - (and (window--resizable-p window delta nil 'safe nil nil nil t) + (let* ((delta (max (- (* (frame-char-height frame) (cdr height)) + (window-body-height window t)) + (- (* (frame-char-height frame) min-height) + (window-pixel-height window))))) + (and (window--resizable-p window delta nil 'safe nil nil nil t) (window-combined-p window) (window-resize window delta nil 'safe t))) (setq resize-temp-buffer-window-inhibit 'vertical)) ((functionp height) - (ignore-errors (funcall height window)) - (setq resize-temp-buffer-window-inhibit 'vertical))) + (let* ((min-height (cdr (assq 'window-min-height alist))) + (window-min-height min-height)) + (ignore-errors (funcall height window)) + (setq resize-temp-buffer-window-inhibit 'vertical)))) ;; Adjust width of window if asked for. (cond ((not width) @@ -7327,26 +7336,31 @@ window--display-buffer (setq resize-temp-buffer-window-inhibit 'horizontal))) ((numberp width) (let* ((new-width - (if (integerp width) - width - (round - (* (window-total-width (frame-root-window window)) - width)))) + (max + (if (integerp width) + width + (round + (* (window-total-width (frame-root-window window)) + width))) + min-width)) (delta (- new-width (window-total-width window)))) (when (and (window--resizable-p window delta t 'safe) (window-combined-p window t)) (window-resize window delta t 'safe))) (setq resize-temp-buffer-window-inhibit 'horizontal)) ((and (consp width) (eq (car width) 'body-columns)) - (let* ((delta (- (* (frame-char-width frame) (cdr width)) - (window-body-width window t)))) + (let* ((delta (max (- (* (frame-char-width frame) (cdr width)) + (window-body-width window t)) + (- (* (frame-char-width frame) min-width) + (window-pixel-width window))))) (and (window--resizable-p window delta t 'safe nil nil nil t) (window-combined-p window t) (window-resize window delta t 'safe t))) (setq resize-temp-buffer-window-inhibit 'horizontal)) ((functionp width) - (ignore-errors (funcall width window)) - (setq resize-temp-buffer-window-inhibit 'horizontal))) + (let* ((window-min-width min-width)) + (ignore-errors (funcall width window)) + (setq resize-temp-buffer-window-inhibit 'horizontal)))) ;; Preserve window size if asked for. (when (consp preserve-size)