GNU bug report logs - #57837
29.0.50; fit-window-to-buffer should reposition the buffer

Previous Next

Package: emacs;

Reported by: sds <at> gnu.org

Date: Thu, 15 Sep 2022 17:32:01 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Gregory Heytings <gregory <at> heytings.org>
To: Sam Steingold <sds <at> gnu.org>
Cc: 57837 <at> debbugs.gnu.org
Subject: bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer
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."




This bug report was last modified 2 years and 326 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.