diff --git a/lisp/window.el b/lisp/window.el index eba888a89d..9333f03822 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -9385,14 +9385,15 @@ fit-frame-to-buffer-1 ((numberp (nth 1 sizes)) (* (nth 1 sizes) line-height)) (t (window-min-size window nil nil t)))) (max-width - (min - (cond - ((numberp max-width) (* max-width char-width)) - ((numberp (nth 2 sizes)) (* (nth 2 sizes) char-width)) - (t parent-or-display-width)) - ;; The following is the maximum width that fits into the - ;; left and right margins. - (max (- right-margin left-margin outer-minus-body-width)))) + (unless (eq only 'vertically) + (min + (cond + ((numberp max-width) (* max-width char-width)) + ((numberp (nth 2 sizes)) (* (nth 2 sizes) char-width)) + (t parent-or-display-width)) + ;; The following is the maximum width that fits into the + ;; left and right margins. + (max (- right-margin left-margin outer-minus-body-width))))) (min-width (cond ((numberp min-width) (* min-width char-width))