To reproduce: emacs -Q --eval '(progn (setq fit-window-to-buffer-horizontally t) (set-frame-size nil 120 20) (with-current-buffer-window "*scratch*" nil nil (insert (make-string 20 ?x)) (insert (make-string 10 ?\n)) (insert (make-string 90 ?x)) (split-window-horizontally) (fit-window-to-buffer) (message "window width: %d" (window-width))))' Expected result: window width: 90 Actual result: window width: 20 Patch: