unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: Gregory Heytings <gregory@heytings.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 17:25:18 -0400	[thread overview]
Message-ID: <lz4jx7nha9.fsf@3c22fb11fdab.ant.amazon.com> (raw)
In-Reply-To: <84acc36e7e03e4cba89d@heytings.org> (Gregory Heytings's message of "Fri, 16 Sep 2022 19:34:41 +0000")

> * Gregory Heytings <tertbel@urlgvatf.bet> [2022-09-16 19:34:41 +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.
>>
>> Is that a problem? I mean, is it possible for the point to be invisible?
>
> No, Emacs does its best to ensure that point is always visible.

what does "does its best" mean?
is it possible for Emacs return nil from
(pos-visible-in-window-p (point))

> That's the reason of the scrolling you see: without scrolling (which
> hides the first half of the buffer) point would be invisible.

Both invisible point and point moved before the EOB are, IMO,
preferable over showing a half empty window after C-x w -.

-- 
Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113
https://lastingimpactpsychology.com https://steingoldpsychology.com
https://www.peaceandtolerance.org/ https://fairforall.org
All extremists should be taken out and shot.





  reply	other threads:[~2022-09-16 21:25 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
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 [this message]
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=lz4jx7nha9.fsf@3c22fb11fdab.ant.amazon.com \
    --to=sds@gnu.org \
    --cc=57837@debbugs.gnu.org \
    --cc=gregory@heytings.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).