From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#34723: 27.0.50; customize and improve diff-mode recentering Date: Wed, 13 Mar 2019 15:40:16 -0400 Message-ID: References: <8336o1e33w.fsf@gnu.org> <83r2blcdj2.fsf@gnu.org> <83h8cgc7ih.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="165373"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 34723@debbugs.gnu.org To: charles@aurox.ch (Charles A. Roelli) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 13 20:43:26 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h49mY-000ggO-LJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Mar 2019 20:43:18 +0100 Original-Received: from localhost ([127.0.0.1]:49891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h49mX-0002Zr-Bp for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Mar 2019 15:43:17 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h49mJ-0002Xx-Vd for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:43:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h49kO-0006bJ-2O for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:41:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57212) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h49kM-0006X5-Dj for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:41:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h49kM-00015B-5t for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2019 19:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34723 X-GNU-PR-Package: emacs Original-Received: via spool by 34723-submit@debbugs.gnu.org id=B34723.15525060264111 (code B ref 34723); Wed, 13 Mar 2019 19:41:02 +0000 Original-Received: (at 34723) by debbugs.gnu.org; 13 Mar 2019 19:40:26 +0000 Original-Received: from localhost ([127.0.0.1]:42523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h49jm-00014D-0i for submit@debbugs.gnu.org; Wed, 13 Mar 2019 15:40:26 -0400 Original-Received: from alt24.smtp-out.videotron.ca ([70.80.0.75]:10984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h49jj-00013z-DT for 34723@debbugs.gnu.org; Wed, 13 Mar 2019 15:40:24 -0400 Original-Received: from fmsmemgm.homelinux.net ([24.203.163.157]) by Videotron with SMTP id 49jchnBG1WvYs49jdhKUv2; Wed, 13 Mar 2019 15:40:18 -0400 X-Authority-Analysis: v=2.3 cv=RJyd4bq+ c=1 sm=1 tr=0 a=271BjrAMcq2W4n6OKK/JJg==:117 a=271BjrAMcq2W4n6OKK/JJg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=NTGMnVQrEZIA:10 a=OhiXZbE5_HqxRmwPKDoA:9 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 68826AEB94; Wed, 13 Mar 2019 15:40:16 -0400 (EDT) In-Reply-To: (Charles A. Roelli's message of "Thu, 07 Mar 2019 20:49:54 +0100") X-CMAE-Envelope: MS4wfBXCyxaFYfsZQmuOO8kYa2FqpsniV3nh1O++LRhmOvzqpQRrdrhQG6HC/68iPE7hAsS5mVG08TxLWb40CaTAkmJbIhrAJYGRFVCWVQwnfcB50pGvwl2l Y5IRcHlAQaC9Jdgi/f97QArxg31fauI44stHI1Q+XiVhw0BEvk2xdyxx6ex+6jwlRNklVlP8wfRJAvEHxStf3PANafDFdds7ywpsD0RapCyG/NXMfppZ2Jix m1FGrY4hzFTTolTWfBN8kJBpiUJONXi4ZVDMifoNjY4= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156309 Archived-At: [ Author responsible for the call to recenter speaking ;-) ] > BASE-next also tries to make sure that the whole entry is visible by > searching for its end (by calling ENDFUN if provided or by looking for > the next entry) and recentering if necessary. That's indeed the purpose. When I move to the next hunk, I almost always want to see that hunk, and that often requires some kind of "recentering". > There are cases where recentering does "make sure that the whole entry > is visible", but as we saw in the first post of this report, there is > at least one case where recentering makes less useful context visible. That's clearly undesirable, indeed. I think it's a plain bug. Basically when moving in one direction, diff-hunk-next/prev should never scroll the buffer in the other direction. > 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). >> Note that without recentering, if you just move point to some location >> in the diffs, when scroll-conservatively > 100, point will wind up >> either on the last screen line of the window or its first screen line, >> depending on whether you move forward or back in the buffer. The >> latter might be okay, but the former will most probably hide most of >> the hunk, which might be the reason for recentering (I'm just guessing >> here). > > 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? 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. 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? Stefan