Subject: Re: bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer

From: Gregory Heytings <[email-masked]>
Date: Thu, 15 Sep 2022 22:59:57 +0000

>> (advice-add 'fit-window-to-buffer :after
>> 	    (lambda () (and (= (count-lines (point-min) (point-max)) (1- (window-height)))
>> 			    (or (< (point) (point-max)) (forward-line -1) t)
>> 			    (set-window-start nil (point-min)))))
>
> Why shouldn't this be the default behavior?
>

I think because fit-window-to-buffer isn't supposed to move point, and 
point would become invisible if it is not moved.  The docstring says: 
"Note that even if this function makes WINDOW large enough to show _all_ 
parts of its buffer you might not see the first part when WINDOW was 
scrolled."