unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Make scroll-{up, down} move point to {start, end} of newly visible text
Date: Wed, 16 Aug 2023 16:32:22 -0400	[thread overview]
Message-ID: <iermsyqpw2x.fsf@janestreet.com> (raw)
In-Reply-To: 83msyq7s82.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Date: Wed, 16 Aug 2023 13:55:42 -0400
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> (defun my-scroll-up-command (&optional arg)
>> >>   (interactive "^P")
>> >>   (move-to-window-line -1)
>> >>   (scroll-up-command arg))
>> >> 
>> >> (defun my-scroll-down-command (&optional arg)
>> >>   (interactive "^P")
>> >>   (move-to-window-line 0)
>> >>   (scroll-down-command arg))
>> >> 
>> >> except of course this implementation moves point even if it's not
>> >> necessary.
>> >> 
>> >> Does this seem like a reasonable feature to add to the scrolling code?
>> >
>> > I don't understand what you have in mind.  The above commands seem to
>> > do what you want only when ARG is 1.  Or what did I miss?
>> 
>> They're actually wrong when ARG is 1, because they move point without
>> needing to.  They mostly only work when ARG is nil.
>
> That's what I meant: only 1 widow-full scroll.
>
>> See the prose description of what I want, the commands are close to but
>> not exactly right because they move point unnecessarily:
>> 
>> >> When point is off-screen after scroll-up, we should first try to move
>> >> point to "window-end before we scrolled", and only if that position is
>> >> also off-screen should we move point to window-start.  (Currently we
>> >> unconditionally move point to window-start)
>> 
>> > For scrolling just one window-full, setting next-screen-context-lines
>> > to 1 should do what you want.  For scrolling more than that, I don't
>> > understand how to generalize what you want.
>> 
>> The prose description I gave generalizes just fine, doesn't it?  The
>> prose description is completely invariant to how much scrolling is done.
>
> Either setting next-screen-context-lines to 1 should do what you want,
> or I still don't understand what you want when scrolling by more than
> one window-full.

Well, yes, if next-screen-context-lines is 1 then
window-end-before-scroll and window-start-after-scroll are the same.  So
that trivially provides the behavior I described, I suppose...

But I want the behavior I described even when next-screen-context-lines
is greater than 1.  (I personally set it to 10.)  In that case,
window-end-before-scroll and window-start-after-scroll aren't the same,
and Emacs doesn't behave how I described.




  reply	other threads:[~2023-08-16 20:32 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 20:18 Make scroll-{up, down} move point to {start, end} of newly visible text Spencer Baugh
2023-08-01  1:26 ` [External] : " Drew Adams
2023-08-01 11:44   ` hw
2023-08-01  5:11 ` Michael Heerdegen
2023-08-01 14:49   ` [External] : " Drew Adams
2023-08-01 11:28 ` hw
2023-08-01 14:45   ` Spencer Baugh
2023-08-01 16:05     ` hw
2023-08-01 12:42 ` Eli Zaretskii
2023-08-01 14:50   ` Spencer Baugh
2023-08-01 15:44     ` Eli Zaretskii
2023-08-01 18:09       ` Spencer Baugh
2023-08-01 18:35         ` Eli Zaretskii
2023-08-01 18:43           ` Spencer Baugh
2023-08-03 19:58             ` Spencer Baugh
2023-08-04  5:31               ` Eli Zaretskii
2023-08-06 20:02                 ` Emanuel Berg
2023-08-08 12:41                   ` Eli Zaretskii
2023-08-09 20:59                     ` Emanuel Berg
2023-08-10 17:33                       ` Eli Zaretskii
2023-08-10 18:06                         ` Emanuel Berg
2023-08-11 11:30                           ` Eli Zaretskii
2023-08-11 12:19                             ` Emanuel Berg
2023-08-11 18:40                               ` Eli Zaretskii
2023-08-11 19:00                                 ` Emanuel Berg
2023-08-12 13:30                                   ` Eli Zaretskii
2023-08-11 19:04                                 ` Emanuel Berg
2023-08-12 13:31                                   ` Eli Zaretskii
2023-08-12 15:35                                     ` Emanuel Berg
2023-08-13 13:23                                       ` Eli Zaretskii
2023-08-20  3:38                                         ` Emanuel Berg
2023-08-22 12:29                                           ` Eli Zaretskii
2023-08-22 19:41                                             ` Emanuel Berg
2023-08-24  4:43                                               ` Eli Zaretskii
2023-08-24  5:13                                                 ` Emanuel Berg
2023-08-16 16:20   ` Spencer Baugh
2023-08-16 16:53     ` Eli Zaretskii
2023-08-16 17:55       ` Spencer Baugh
2023-08-16 18:33         ` Eli Zaretskii
2023-08-16 20:32           ` Spencer Baugh [this message]
2023-08-17  5:18             ` Eli Zaretskii
2023-08-17 12:19               ` Spencer Baugh
2023-08-17 12:30                 ` Eli Zaretskii
2023-08-02 10:06 ` Emanuel Berg

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=iermsyqpw2x.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=help-gnu-emacs@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.
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).