unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: sds@gnu.org
Cc: 57837@debbugs.gnu.org
Subject: bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer
Date: Fri, 16 Sep 2022 08:53:44 +0300	[thread overview]
Message-ID: <83v8pn50gn.fsf@gnu.org> (raw)
In-Reply-To: <lzy1ukntch.fsf@3c22fb11fdab.ant.amazon.com> (message from Sam Steingold on Thu, 15 Sep 2022 18:52:30 -0400)

> 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.





  reply	other threads:[~2022-09-16  5:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 17:31 bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer Sam Steingold
2022-09-15 18:03 ` Eli Zaretskii
2022-09-15 18:30   ` Sam Steingold
2022-09-15 18:55     ` Sam Steingold
2022-09-15 19:07       ` Eli Zaretskii
2022-09-15 22:52         ` Sam Steingold
2022-09-16  5:53           ` Eli Zaretskii [this message]
2022-09-15 19:00     ` Eli Zaretskii
2022-09-15 19:34 ` Gregory Heytings
2022-09-15 22:45   ` Sam Steingold
2022-09-15 22:59     ` Gregory Heytings
2022-09-16 18:52       ` Sam Steingold
2022-09-16 19:34         ` Gregory Heytings
2022-09-16 21:25           ` Sam Steingold
2022-09-16 21:34             ` Gregory Heytings
2022-09-17  6:48               ` Eli Zaretskii
2022-09-17  7:10                 ` Gregory Heytings
2022-09-17  7:25                   ` Eli Zaretskii
2022-09-18  8:34               ` Gregory Heytings
2022-09-16  5:45     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83v8pn50gn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=57837@debbugs.gnu.org \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).