Function: fit-frame-to-buffer

Adjust height of FRAME to display its buffer contents exactly.
FRAME can be any live frame and defaults to the selected one.

Optional argument MAX-HEIGHT specifies the maximum height of FRAME.
It defaults to the height of the display below the current
top line of FRAME, minus `fit-frame-to-buffer-bottom-margin'.
Optional argument MIN-HEIGHT specifies the minimum height of FRAME.
The default corresponds to `window-min-height'.

Variable: fit-frame-to-buffer

Non-nil means `fit-window-to-buffer' can resize frames.
A frame can be resized if and only if its root window is a live
window. The height of the root window is subject to the values
of `fit-frame-to-buffer-max-height' and `window-min-height'.