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: Eli Zaretskii <eliz <at> gnu.org>
To: 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:00:36 +0300
> From: Sam Steingold <sds <at> gnu.org>
> Cc: 57837 <at> debbugs.gnu.org
> Date: Thu, 15 Sep 2022 14:30:36 -0400
> 
> >> Basically, after `fit-window-to-buffer' is called, the following should
> >> evaluate to t:
> >> 
> >> --8<---------------cut here---------------start------------->8---
> >> (and (pos-visible-in-window-p (point-min))
> >>      (pos-visible-in-window-p (point-max)))
> >> --8<---------------cut here---------------end--------------->8---
> >
> > No, because point-max is after the last newline, and thus effectively
> > one line beyond the window's text.
> 
> As I said, if `fit-window-to-buffer' has a "contract", it's the invariant
> above.  Violating it, albeit in a corner case, is, IMO, a bug.

I think you misunderstand the contract: the function fits the window
to the buffer text, which doesn't include the (imaginary) place beyond
the last character.

When you are are EOB, doesn't "C-x =" say something like

  point=N out of N-1 (EOB)

?  Do you see what I mean by "beyond the last character"?

> I am not sure how this should be fixed

It shouldn't be fixed, because it ain't broken.




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.