It is possible to "scroll past the end of the buffer" in a window. This is useful because Emacs has to somehow use the extra space when the buffer does not fill the whole area available to the window used to display it.
However sometimes when the whole buffer would fit completely into the window the top part still isn't displayed and more space than necessary is wasted below the buffer content to fill the available space. It would be better if the window were automatically scrolled to show the complete buffer or if it is bigger than the window as much as possible.
In other words the only time when a window displays something "below the buffer end" is when the window is to big.
Is there a mode or option to do that?
Edit: So something like this?
(add-hook 'post-command-hook 'my-eob-recenter)
(defun my-eob-recenter ()
(when (pos-visible-in-window-p (point-max))
(save-excursion
(goto-char (point-max))
(recenter -1))))
Original answer:
If you have a window which is larger than its contents and you want to shrink it to fit, there's a binding for that.
C-x- runs shrink-window-if-larger-than-buffer
Personally I suspect this would be annoying if it happened automatically, but you might try this:
(defadvice split-window (after my-split-window-shrink)
"Shrink the selected window after a window split
if it is larger than its contents."
(shrink-window-if-larger-than-buffer))
(ad-activate 'split-window)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With