unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: charles@aurox.ch (Charles A. Roelli)
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 34723@debbugs.gnu.org
Subject: bug#34723: 27.0.50; customize and improve diff-mode recentering
Date: Sat, 16 Mar 2019 21:21:40 +0100	[thread overview]
Message-ID: <m2wokytvsb.fsf@aurox.ch> (raw)
In-Reply-To: <jwvimwm8tmt.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Wed, 13 Mar 2019 15:40:16 -0400)

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Wed, 13 Mar 2019 15:40:16 -0400

> > The current implementation seems a little too eager.
> 
> Sometimes it's also not eager enough (if the hunk is longer than half of
> the screen, it shouldn't just recenter but it should likely scroll
> further so that more than half of the screen shows the hunk).

Yes.  In that specific case, we could call (recenter 0) to make more
(or all of) the hunk visible.
 
> > Yes, I think you are right.  Maybe diff-mode could have just set
> > scroll-conservatively (or scroll-margin) in a buffer-local variable to
> > get this auto-recentering behavior, although that would also step on
> > user customizations.
> 
> Not sure what you mean.  I have scroll-conservatively set to 0.
> How should I set it to get the recentering that I want?

Setting scroll-conservatively to 0 in diff-mode would of course not be
enough to recenter in all the cases where diff-hunk-next currently
does, but it would be a bit cleaner.  The part of the code that
recenters based on the visibility of the end of the hunk at point
could instead go in a post-command-hook (or in a display hook?), which
would make it work after all movement commands, not just
diff-hunk-next.  I don't know if that's desirable, though.

> As for scroll-margin, I don't like using it.  Also it would affect all
> cursor movement rather than only diff-hunk-* and would force point
> closer to the middle which is not what I want when the hunk is longer
> than half the window.

Agreed.

> In your original message you said:
> > We found that this behavior does not respect scroll-related variables
> 
> Did that only refer to `scroll-conservatively`?  If not, could you
> clarify which scroll-related variable setting is not respected,
> and when?

Hm, I'm not sure if there was another variable that the behavior
affects (can't find one now).  This is no big issue; it's an argument
for making the behavior customizable.





  parent reply	other threads:[~2019-03-16 20:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-03 20:38 bug#34723: 27.0.50; customize and improve diff-mode recentering Charles A. Roelli
2019-03-03 21:33 ` Juri Linkov
2019-03-04 19:06   ` Charles A. Roelli
2019-03-04 21:12     ` Juri Linkov
2019-03-05 16:11     ` Eli Zaretskii
2019-03-05 20:11       ` Charles A. Roelli
2019-03-05 20:22         ` Eli Zaretskii
2019-03-07 19:12           ` Charles A. Roelli
2019-03-05 15:46 ` Eli Zaretskii
2019-03-05 19:49   ` Charles A. Roelli
2019-03-05 19:44     ` Eli Zaretskii
2019-03-05 20:37       ` Charles A. Roelli
2019-03-06 16:06         ` Eli Zaretskii
2019-03-07 19:49           ` Charles A. Roelli
2019-03-13 19:40             ` Stefan Monnier
2019-03-13 19:56               ` Stefan Monnier
2019-03-16 19:39                 ` Charles A. Roelli
2019-03-16 22:37                   ` Stefan Monnier
2019-03-16 20:21               ` Charles A. Roelli [this message]
2019-03-22 19:32                 ` Stefan Monnier

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=m2wokytvsb.fsf@aurox.ch \
    --to=charles@aurox.ch \
    --cc=34723@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).