[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer
From: |
Eli Zaretskii |
Subject: |
bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer |
Date: |
Fri, 16 Sep 2022 08:53:44 +0300 |
> From: Sam Steingold <sds@gnu.org>
> Cc: 57837@debbugs.gnu.org
> Date: Thu, 15 Sep 2022 18:52:30 -0400
>
> > * Eli Zaretskii <ryvm@tah.bet> [2022-09-15 22:07:15 +0300]:
> >
> >> > >> --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---
> >>
> >> replacing `poing-min` and `point-max` with beginning-of-text and
> >> end-of-text, of course...
> >
> > What are beginning-of-text and end-of-text? I don't find such
> > functions in Emacs.
>
> I meant something like this:
>
> --8<---------------cut here---------------start------------->8---
> (defun beginning-of-text ()
> (save-excursion
> (goto-char (point-min))
> (1- (re-search-forward "[[:graph:]]" nil t))))
> --8<---------------cut here---------------end--------------->8---
Thanks, but your problem wasn't with beginning-of-text, it was with
end-of-text. And you haven't explained what you consider end-of-text.
Moreover, the assumption that fit-window-to-buffer ignores
non-[:graph:] characters is false. This function counts everything
that's displayed as some kind of glyph, no matter what kind of
character that is.
What you see in the case you described, when this function is called
with point at EOB, is the normal Emacs display operation: after the
command completes, if point is outside the window, Emacs scrolls the
display to bring point back into view. The trigger for that scrolling
is the fact that you positioned point at EOB. So don't.
bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Gregory Heytings, 2022/09/15
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Sam Steingold, 2022/09/15
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Gregory Heytings, 2022/09/15
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Sam Steingold, 2022/09/16
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Gregory Heytings, 2022/09/16
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Sam Steingold, 2022/09/16
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Gregory Heytings, 2022/09/16
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Eli Zaretskii, 2022/09/17
- bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer, Gregory Heytings, 2022/09/17