GNU bug report logs - #34723
27.0.50; customize and improve diff-mode recentering

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: charles@HIDDEN; dated Sun, 3 Mar 2019 20:33:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 22 Mar 2019 19:33:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 15:33:05 2019
Received: from localhost ([127.0.0.1]:54693 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h7Pub-0004X9-55
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2019 15:33:05 -0400
Received: from alt34.smtp-out.videotron.ca ([24.53.0.23]:35233)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1h7PuX-0004Wd-GY
 for 34723 <at> debbugs.gnu.org; Fri, 22 Mar 2019 15:33:03 -0400
Received: from fmsmemgm.homelinux.net ([24.203.163.157]) by Videotron with SMTP
 id 7PuPhBFmxuR9T7PuQh0pxX; Fri, 22 Mar 2019 15:32:55 -0400
X-Authority-Analysis: v=2.3 cv=N+kH6V1B c=1 sm=1 tr=0
 a=271BjrAMcq2W4n6OKK/JJg==:117 a=271BjrAMcq2W4n6OKK/JJg==:17
 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=IkcTkHD0fZMA:10 a=NTGMnVQrEZIA:10
 a=livkJCoIFQ6mIVuaV2cA:9 a=QEXdDO2ut3YA:10
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id 61CFFAEC22; Fri, 22 Mar 2019 15:32:53 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: charles@HIDDEN (Charles A. Roelli)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
Message-ID: <jwvh8bu67ak.fsf-monnier+emacs@HIDDEN>
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN>
 <m28sxtukfn.fsf@HIDDEN> <83h8cgc7ih.fsf@HIDDEN>
 <m236nyv50d.fsf@HIDDEN> <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN>
 <m2wokytvsb.fsf@HIDDEN>
Date: Fri, 22 Mar 2019 15:32:53 -0400
In-Reply-To: <m2wokytvsb.fsf@HIDDEN> (Charles A. Roelli's message of "Sat,
 16 Mar 2019 21:21:40 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-CMAE-Envelope: MS4wfCihn9S1Ojw08dD55OrzwjskVrA5MyISlh4rd1fZxBH1iviP0TaDBUIDnMz8wJGk163Hrzia4HuN5UcUt7noLVeQoKQZ5vxuDYcfchtfD9+Ci/DfXINQ
 rkuU6Prjuxdgt/vsK0NCh/T2pF/BdgIE/cF+NswYX3mAXzAK7yDcqigN5iOqPkA35242pA3MX2B5gLWcEoB71DN7b6QYsF+Ofo0g5euoFUt9ojjz8fw3l3dv
 XeCrQAmydQXEu6WlhV2uydh1+plvMR5Z2D8Ue3+I+FE=
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 34723
Cc: eliz@HIDDEN, 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

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

I think in some cases I'd like it, yes.  But would you?
I thought you didn't want recentering in next-hunk at all=E2=80=BD
Also I'm not sure if it would annoy me more often than not, which is
probably why I haven't bothered to try and code it up.

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

Yes, feel free to add such a custom var.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 16 Mar 2019 22:37:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 16 18:37:26 2019
Received: from localhost ([127.0.0.1]:46785 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h5Hvi-00035b-Ea
	for submit <at> debbugs.gnu.org; Sat, 16 Mar 2019 18:37:26 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:49378)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1h5Hvd-00035N-R4
 for 34723 <at> debbugs.gnu.org; Sat, 16 Mar 2019 18:37:25 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x2GMbB1h031093;
 Sat, 16 Mar 2019 18:37:11 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 239976ABE1; Sat, 16 Mar 2019 18:37:11 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: charles@HIDDEN (Charles A. Roelli)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
Message-ID: <jwvbm2a5tvr.fsf-monnier+emacs@HIDDEN>
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN>
 <m28sxtukfn.fsf@HIDDEN> <83h8cgc7ih.fsf@HIDDEN>
 <m236nyv50d.fsf@HIDDEN> <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN>
 <jwvd0mu8s6g.fsf-monnier+emacs@HIDDEN> <m2y35etxr3.fsf@HIDDEN>
Date: Sat, 16 Mar 2019 18:37:11 -0400
In-Reply-To: <m2y35etxr3.fsf@HIDDEN> (Charles A. Roelli's message of "Sat,
 16 Mar 2019 20:39:12 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.1
X-NAI-Spam-Rules: 3 Rules triggered
 GEN_SPAM_FEATRE=0.1, EDT_SA_DN_PASS=0, RV6504=0
X-NAI-Spam-Version: 2.3.0.9418 : core <6504> : inlines <7035> : streams
 <1815911> : uri <2814197>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: eliz@HIDDEN, 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Thanks!  I noticed that I had to "touch lisp/vc/diff-mode.el" before
> the change took effect in my local tree, since the change in the macro
> does not trigger the recompilation of the callers.  Could "make"
> somehow detect this?

Depends if you want the theoretical answer or the practical one ;-)


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 16 Mar 2019 20:08:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 16 16:08:32 2019
Received: from localhost ([127.0.0.1]:46744 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h5Fbc-0007sU-4B
	for submit <at> debbugs.gnu.org; Sat, 16 Mar 2019 16:08:32 -0400
Received: from nestroy.aurox.ch ([82.195.237.20]:42956)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h5Fba-0007sC-Ok
 for 34723 <at> debbugs.gnu.org; Sat, 16 Mar 2019 16:08:31 -0400
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44MD5z6fzBzt5q
 for <34723 <at> debbugs.gnu.org>; Sat, 16 Mar 2019 20:08:23 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1552766903; x=1555358904; bh=K
 gCJMPiZuZV+W1kMqfFJ8HgoGOWOSn9tI8/alG6fQOA=; b=hTHFwx2BFryy1BGcG
 KFRXi2FSJWhR04T7FwQYVUFLF67NmPPG1E8NeAYutZzogWeIKM1s4SDH0pGoAz8o
 FV8nvc8HzaetpoMkz/1apQtFLLnoN4Op3PHvhKLk6bi5Twx6JeBAfAP4As235hRJ
 eM9rDRS/IDkQSf+nrXhFk7AaH4=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id Tc206kmoBy3A for <34723 <at> debbugs.gnu.org>;
 Sat, 16 Mar 2019 20:08:23 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44MD5y60zxzt5V;
 Sat, 16 Mar 2019 20:08:22 +0000 (UTC)
Date: Sat, 16 Mar 2019 21:21:40 +0100
Message-Id: <m2wokytvsb.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Wed, 13 Mar 2019 15:40:16 -0400)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN> <m28sxtukfn.fsf@HIDDEN>
 <83h8cgc7ih.fsf@HIDDEN> <m236nyv50d.fsf@HIDDEN>
 <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: eliz@HIDDEN, 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Monnier <monnier@HIDDEN>
> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 16 Mar 2019 19:26:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 16 15:26:09 2019
Received: from localhost ([127.0.0.1]:46725 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h5Ewb-0004pw-As
	for submit <at> debbugs.gnu.org; Sat, 16 Mar 2019 15:26:09 -0400
Received: from nestroy.aurox.ch ([82.195.237.20]:42740)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h5EwZ-0004pV-8a
 for 34723 <at> debbugs.gnu.org; Sat, 16 Mar 2019 15:26:08 -0400
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44MC95260Jzt58
 for <34723 <at> debbugs.gnu.org>; Sat, 16 Mar 2019 19:26:01 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1552764359; x=1555356360; bh=3
 Fe58oGLH5EdYR0i/Wp3O2V2G/r6GsF5zyC/BvpgLkA=; b=pPe/KE388wQK/rUN7
 DUennQHklrOw0fkecQobKU2OIRaaTNpdvdxbDpLcHz143Eb+a5wklcjwHDMFQsgn
 s/a0a/2o8S/d65Ouywqc+rWKEtt3xjVUf1k9QNhpRLleu/22HostW1gWGu0G1jwa
 H7xCApHumYSHeZfqZMRSHKjkiY=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 714nk-gmd9ro for <34723 <at> debbugs.gnu.org>;
 Sat, 16 Mar 2019 19:25:59 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44MC9336sGzt4q;
 Sat, 16 Mar 2019 19:25:59 +0000 (UTC)
Date: Sat, 16 Mar 2019 20:39:12 +0100
Message-Id: <m2y35etxr3.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwvd0mu8s6g.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Wed, 13 Mar 2019 15:56:50 -0400)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN> <m28sxtukfn.fsf@HIDDEN>
 <83h8cgc7ih.fsf@HIDDEN> <m236nyv50d.fsf@HIDDEN>
 <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN>
 <jwvd0mu8s6g.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: eliz@HIDDEN, 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Monnier <monnier@HIDDEN>
> Date: Wed, 13 Mar 2019 15:56:50 -0400
> 
> >> 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.
> 
> I installed the patch below which should fix this most glaring problem.
> 
> 
>         Stefan

Thanks!  I noticed that I had to "touch lisp/vc/diff-mode.el" before
the change took effect in my local tree, since the change in the macro
does not trigger the recompilation of the callers.  Could "make"
somehow detect this?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 13 Mar 2019 19:56:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 13 15:56:59 2019
Received: from localhost ([127.0.0.1]:42542 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h49zn-0001Si-5E
	for submit <at> debbugs.gnu.org; Wed, 13 Mar 2019 15:56:59 -0400
Received: from alt24.smtp-out.videotron.ca ([70.80.0.75]:14824)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1h49zl-0001SW-8F
 for 34723 <at> debbugs.gnu.org; Wed, 13 Mar 2019 15:56:58 -0400
Received: from fmsmemgm.homelinux.net ([24.203.163.157]) by Videotron with SMTP
 id 49zehnEBpWvYs49zfhKWID; Wed, 13 Mar 2019 15:56:51 -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=_VCwzydACaJPHcMw6VYA:9
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id 97F0AAEB94; Wed, 13 Mar 2019 15:56:50 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: charles@HIDDEN (Charles A. Roelli)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
Message-ID: <jwvd0mu8s6g.fsf-monnier+emacs@HIDDEN>
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN>
 <m28sxtukfn.fsf@HIDDEN> <83h8cgc7ih.fsf@HIDDEN>
 <m236nyv50d.fsf@HIDDEN> <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN>
Date: Wed, 13 Mar 2019 15:56:50 -0400
In-Reply-To: <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Wed, 13 Mar 2019 15:40:16 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-CMAE-Envelope: MS4wfPDCwsvMRuHYfL/00eWomL96UbZej0M0E626jT9vOnij0eaKws8ONE86JujMKUk9PZkslOTem9cASuV79yuhAPJFHSkW0DAvlY1dB8Us/11wv7Fy6nLX
 +c/SmpHUNmOyLe12YSZNDyYWXV6EcSkNsWWsS6cz0A17r8WMVD5OsSpm6M1eSXc3WewwaTSDQrjX9EVBfhmBdkvVhbCer9A7fR9RNDZdd70ZBKkCcbteE1lJ
 P3gryXsy+C9SGsdZFTcp30Qs9K3UJPsZk4jHB5crj2U=
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 34723
Cc: Eli Zaretskii <eliz@HIDDEN>, 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

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

I installed the patch below which should fix this most glaring problem.


        Stefan


diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index b866a95443..57cf5c86f4 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -625,6 +625,7 @@ easy-mmode-define-navigation
                  ,body
                  (when was-narrowed (funcall #',narrowfun)))))))
     (unless name (setq name base-name))
+    ;; FIXME: Move most of those functions's bodies to helper functions!
     `(progn
        (defun ,next-sym (&optional count)
 	 ,(format "Go to the next COUNT'th %s.
@@ -646,7 +647,11 @@ easy-mmode-define-navigation
                                         `(re-search-forward ,re nil t 2)))
                                    (point-max))))
                     (unless (pos-visible-in-window-p endpt nil t)
-                      (recenter '(0)))))))
+                      (let ((ws (window-start)))
+                        (recenter '(0))
+                        (if (< (window-start) ws)
+                            ;; recenter scrolled in the wrong direction!
+                            (set-window-start nil ws))))))))
            ,@body))
        (put ',next-sym 'definition-name ',base)
        (defun ,prev-sym (&optional count)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 13 Mar 2019 19:40:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 13 15:40:26 2019
Received: from localhost ([127.0.0.1]:42523 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h49jm-00014D-0i
	for submit <at> debbugs.gnu.org; Wed, 13 Mar 2019 15:40:26 -0400
Received: from alt24.smtp-out.videotron.ca ([70.80.0.75]:10984)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1h49jj-00013z-DT
 for 34723 <at> debbugs.gnu.org; Wed, 13 Mar 2019 15:40:24 -0400
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
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id 68826AEB94; Wed, 13 Mar 2019 15:40:16 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: charles@HIDDEN (Charles A. Roelli)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
Message-ID: <jwvimwm8tmt.fsf-monnier+emacs@HIDDEN>
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN>
 <m28sxtukfn.fsf@HIDDEN> <83h8cgc7ih.fsf@HIDDEN>
 <m236nyv50d.fsf@HIDDEN>
Date: Wed, 13 Mar 2019 15:40:16 -0400
In-Reply-To: <m236nyv50d.fsf@HIDDEN> (Charles A. Roelli's message of "Thu,
 07 Mar 2019 20:49:54 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-CMAE-Envelope: MS4wfBXCyxaFYfsZQmuOO8kYa2FqpsniV3nh1O++LRhmOvzqpQRrdrhQG6HC/68iPE7hAsS5mVG08TxLWb40CaTAkmJbIhrAJYGRFVCWVQwnfcB50pGvwl2l
 Y5IRcHlAQaC9Jdgi/f97QArxg31fauI44stHI1Q+XiVhw0BEvk2xdyxx6ex+6jwlRNklVlP8wfRJAvEHxStf3PANafDFdds7ywpsD0RapCyG/NXMfppZ2Jix
 m1FGrY4hzFTTolTWfBN8kJBpiUJONXi4ZVDMifoNjY4=
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 34723
Cc: Eli Zaretskii <eliz@HIDDEN>, 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

[ 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 7 Mar 2019 19:37:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 07 14:37:34 2019
Received: from localhost ([127.0.0.1]:35630 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1ypi-0001Dy-9P
	for submit <at> debbugs.gnu.org; Thu, 07 Mar 2019 14:37:34 -0500
Received: from nestroy.aurox.ch ([82.195.237.20]:41900)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h1ypg-0001Dl-KL
 for 34723 <at> debbugs.gnu.org; Thu, 07 Mar 2019 14:37:33 -0500
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44FgrQ0TLlznD4
 for <34723 <at> debbugs.gnu.org>; Thu,  7 Mar 2019 19:37:26 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1551987445; x=1554579446; bh=z
 eEI1kFtVLeLRStQBixyxhZyrvcDcMP1ehfTvwYGnu8=; b=KgnAev+kYB9Yzj8/o
 X/XBLCFGfX5zDbkcBdseHHxTNsQ44RUeFD9Al+pNElf2XZHV7TVArouvxsb1v1DN
 sqULryk4uITHzSn/u5qt6SLSCYzcIRa1oe87hraopuYN6nFYHqYDk8Fvm/Pj1gCb
 Qm1cFeg4DhO9saqe1aXp+Qo9OM=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id SXZDairxemJI for <34723 <at> debbugs.gnu.org>;
 Thu,  7 Mar 2019 19:37:25 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44FgrP0z07znCx;
 Thu,  7 Mar 2019 19:37:25 +0000 (UTC)
Date: Thu, 07 Mar 2019 20:49:54 +0100
Message-Id: <m236nyv50d.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <83h8cgc7ih.fsf@HIDDEN> (message from Eli Zaretskii on Wed, 06
 Mar 2019 18:06:14 +0200)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN> <m28sxtukfn.fsf@HIDDEN>
 <83h8cgc7ih.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 06 Mar 2019 18:06:14 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> Why does it call 'recenter'?  It must have a reason, doesn't it?  Does
> the history of that code gives a clue?

The doc of easy-mmode-define-navigation says:

  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.

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.
The current implementation seems a little too eager.  I'd like to fix
that, and at least allow to toggle the auto-recentering.

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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 7 Mar 2019 19:00:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 07 14:00:45 2019
Received: from localhost ([127.0.0.1]:35608 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1yG5-0006lu-5u
	for submit <at> debbugs.gnu.org; Thu, 07 Mar 2019 14:00:45 -0500
Received: from nestroy.aurox.ch ([82.195.237.20]:41558)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h1yG2-0006lg-PU
 for 34723 <at> debbugs.gnu.org; Thu, 07 Mar 2019 14:00:43 -0500
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44Fg1w4g0RznBy
 for <34723 <at> debbugs.gnu.org>; Thu,  7 Mar 2019 19:00:36 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1551985235; x=1554577236; bh=W
 trjDYRutJtW+Pri0FmxbJMXIPmPRLixEIS0euwG02o=; b=uE5yHyPDch5AGXqW2
 O6erUsXw8ulz2C0pDBXYvN3JRN9wLQ5ZcID8sdAES2jpRCuAHKe+wGQu8Z1ACZm+
 ePw9uE2jBwdHMDXEQ6MGFY4s5Gip74TLiWY1q1hTeeS0g0gqlqzzWplzx4im4+XG
 5myTKyWWPA/G5TU/kuqtiMLYms=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id K1lftVGy1NbY for <34723 <at> debbugs.gnu.org>;
 Thu,  7 Mar 2019 19:00:35 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44Fg1t5mMNznBf;
 Thu,  7 Mar 2019 19:00:34 +0000 (UTC)
Date: Thu, 07 Mar 2019 20:12:58 +0100
Message-Id: <m27edav6px.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <83pnr5cbqm.fsf@HIDDEN> (message from Eli Zaretskii on Tue, 05
 Mar 2019 22:22:41 +0200)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <87o96rprs3.fsf@HIDDEN>
 <m2d0n6v4re.fsf@HIDDEN> <83y35tcnci.fsf@HIDDEN> <m2a7i9ulni.fsf@HIDDEN>
 <83pnr5cbqm.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 05 Mar 2019 22:22:41 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> It keeps point closer to the center of the window and away from the
> window edges.  I though that's what you wanted, because doing that
> will show more context around the match.

Right.  I spoke earlier about calling reposition-window from
diff-hunk-next as a possible replacement for recenter, and Juri
suggested an equivalent behavior for Isearch, and the aim of these
changes is to show the most useful context around point -- which does
not necessarily mean keeping point close to the center of the window.
For example, with the Isearch example I gave, point can end up
anywhere in the window after searching, since reposition-window tries
to position the first line of the function definition on the first
screen line.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 6 Mar 2019 16:06:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 06 11:06:40 2019
Received: from localhost ([127.0.0.1]:34613 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1Z42-0002Qd-JH
	for submit <at> debbugs.gnu.org; Wed, 06 Mar 2019 11:06:38 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50735)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1h1Z3z-0002QP-SM
 for 34723 <at> debbugs.gnu.org; Wed, 06 Mar 2019 11:06:36 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:44353)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1h1Z3m-0008Tc-Lq; Wed, 06 Mar 2019 11:06:25 -0500
Received: from [176.228.60.248] (port=3823 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1h1Z3d-0002jA-CZ; Wed, 06 Mar 2019 11:06:16 -0500
Date: Wed, 06 Mar 2019 18:06:14 +0200
Message-Id: <83h8cgc7ih.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: charles@HIDDEN
In-reply-to: <m28sxtukfn.fsf@HIDDEN> (charles@HIDDEN)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN> <m28sxtukfn.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Date: Tue, 05 Mar 2019 21:37:32 +0100
> From: charles@HIDDEN (Charles A. Roelli)
> CC: 34723 <at> debbugs.gnu.org
> 
> > I don't understand what calling 'recenter' has to do with
> > scroll-conservatively.  And scroll-conservatively is implemented in
> > the display engine, so I'm afraid I'm still in the dark regarding the
> > nature of the problem you are discussing.
> 
> Does the following scenario make some sense?  diff-hunk-next moves
> point to a position beyond (window-end), and immediately calls
> (recenter '(0)).  Scrolling (which would otherwise respect
> scroll-conservatively) gets preempted by diff-hunk-next's call to
> recenter.

Why does it call 'recenter'?  It must have a reason, doesn't it?  Does
the history of that code gives a clue?

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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 5 Mar 2019 20:25:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 15:25:25 2019
Received: from localhost ([127.0.0.1]:33507 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1Gcv-0007FW-0T
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2019 15:25:25 -0500
Received: from nestroy.aurox.ch ([82.195.237.20]:35352)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h1Gcs-0007FJ-Q2
 for 34723 <at> debbugs.gnu.org; Tue, 05 Mar 2019 15:25:23 -0500
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44DT0X1DvMzlrC
 for <34723 <at> debbugs.gnu.org>; Tue,  5 Mar 2019 20:25:16 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1551817515; x=1554409516; bh=+
 qWEEWxMQhYdII1Uai2vAu+gMYJcXmmYvjvtSpAUIgI=; b=r1BfvK/UlQv/Yx79Q
 c+G+rIuVNTvVGubFYNGoAu3p85H0dwDua0YFWoY3Xjv95nu35Mfg/rZiSErtFqOy
 cgA6+4ptI6eNX2KBSQzrogGZ9WpXgBxau5sGHP9zZXyrG2+RX9N08x1ZfR4xhYwt
 O78KXIhEDs/8pKAcmjKhhNtYkU=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id QK1tg1SqGYvL for <34723 <at> debbugs.gnu.org>;
 Tue,  5 Mar 2019 20:25:15 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44DT0W1B0szlr5;
 Tue,  5 Mar 2019 20:25:15 +0000 (UTC)
Date: Tue, 05 Mar 2019 21:37:32 +0100
Message-Id: <m28sxtukfn.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <83r2blcdj2.fsf@HIDDEN> (message from Eli Zaretskii on Tue, 05
 Mar 2019 21:44:01 +0200)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN> <83r2blcdj2.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 05 Mar 2019 21:44:01 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> CC: 34723 <at> debbugs.gnu.org
> 
> I don't understand what calling 'recenter' has to do with
> scroll-conservatively.  And scroll-conservatively is implemented in
> the display engine, so I'm afraid I'm still in the dark regarding the
> nature of the problem you are discussing.

Does the following scenario make some sense?  diff-hunk-next moves
point to a position beyond (window-end), and immediately calls
(recenter '(0)).  Scrolling (which would otherwise respect
scroll-conservatively) gets preempted by diff-hunk-next's call to
recenter.

> Of course, if you know what to do to fix the problem, there's no need
> for me to understand the issue, and I should just shut up and let you
> do what you think is right.

(Please don't, I will almost certainly screw it up. ;-)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 5 Mar 2019 20:22:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 15:22:52 2019
Received: from localhost ([127.0.0.1]:33502 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1GaS-0007BR-I7
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2019 15:22:52 -0500
Received: from eggs.gnu.org ([209.51.188.92]:36825)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1h1GaQ-0007BE-Hk
 for 34723 <at> debbugs.gnu.org; Tue, 05 Mar 2019 15:22:51 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:56399)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1h1GaK-0001Fv-ST; Tue, 05 Mar 2019 15:22:44 -0500
Received: from [176.228.60.248] (port=2783 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1h1GaK-0003LV-GK; Tue, 05 Mar 2019 15:22:44 -0500
Date: Tue, 05 Mar 2019 22:22:41 +0200
Message-Id: <83pnr5cbqm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: charles@HIDDEN
In-reply-to: <m2a7i9ulni.fsf@HIDDEN> (charles@HIDDEN)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <87o96rprs3.fsf@HIDDEN>
 <m2d0n6v4re.fsf@HIDDEN> <83y35tcnci.fsf@HIDDEN> <m2a7i9ulni.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Date: Tue, 05 Mar 2019 21:11:13 +0100
> From: charles@HIDDEN (Charles A. Roelli)
> CC: juri@HIDDEN, 34723 <at> debbugs.gnu.org
> 
> > Isn't it easier to temporarily bind scroll-margin to a non-zero value,
> > then force redisplay?
> > 
> > Or maybe I'm missing something in this discussion.
> 
> I'm not sure how binding scroll-margin would change the behavior here.

It keeps point closer to the center of the window and away from the
window edges.  I though that's what you wanted, because doing that
will show more context around the match.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 5 Mar 2019 19:59:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 14:59:12 2019
Received: from localhost ([127.0.0.1]:33487 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1GDX-0006bs-NO
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2019 14:59:11 -0500
Received: from nestroy.aurox.ch ([82.195.237.20]:35124)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h1GDV-0006bd-0d
 for 34723 <at> debbugs.gnu.org; Tue, 05 Mar 2019 14:59:09 -0500
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44DSQG5DGCzlqX
 for <34723 <at> debbugs.gnu.org>; Tue,  5 Mar 2019 19:59:02 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1551815938; x=1554407939; bh=K
 olrfUGVdqdj0Qxhhwzrbci2F8xft+Fo0edfQ5kNbmE=; b=Fl5Q+jc4hTVk8o7Dp
 /ah2buBdO1CRhA5/0EIEU7KJscPBuAPA+ZotElsTttMfzg0oe1mYdvVT324Wi/4h
 LyrdF7yyIwNNC/nUPSvZKwtr7FbY5mNITGAVHCCNUjBZnlO8yZfkbJ6PWdfvl4fw
 CFrdNIZUaMK0JRFj0GCk+E35Jc=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id EHC71yDme5LF for <34723 <at> debbugs.gnu.org>;
 Tue,  5 Mar 2019 19:58:58 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44DSQ96mmVzlqB;
 Tue,  5 Mar 2019 19:58:57 +0000 (UTC)
Date: Tue, 05 Mar 2019 21:11:13 +0100
Message-Id: <m2a7i9ulni.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <83y35tcnci.fsf@HIDDEN> (message from Eli Zaretskii on Tue, 05
 Mar 2019 18:11:57 +0200)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <87o96rprs3.fsf@HIDDEN>
 <m2d0n6v4re.fsf@HIDDEN> <83y35tcnci.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 05 Mar 2019 18:11:57 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> CC: juri@HIDDEN, 34723 <at> debbugs.gnu.org
>
> > >   (setq isearch-push-state-function
> > >         (lambda ()
> > >           (when (and isearch-success (not (pos-visible-in-window-p)))
> > >             (reposition-window))
> > >           `(lambda (cmd)
> > >              (when isearch-success
> > >                (set-window-start nil ,(window-start))))))
> > 
> > Can we add something like this to isearch.el, maybe as a defcustom?
> > Or maybe we could add it in a way such that other packages that show
> > search results (grep, xref) could use the same function to reposition
> > the window.  The function could inspect a defcustom in simple.el to
> > decide whether (or how) to reposition the window.
> 
> Isn't it easier to temporarily bind scroll-margin to a non-zero value,
> then force redisplay?
> 
> Or maybe I'm missing something in this discussion.

I'm not sure how binding scroll-margin would change the behavior here.

IIUC the aim of this snippet is to reposition the window to show as
much of the function definition (or diff hunk, or some other text
structure) that includes the search hit as possible.  For example, if
you evaluate the snippet from emacs -Q, then type, for example

M-x find-library RET simple.el RET
C-s quit-flag

Then Emacs positions the window to show the definition (from the
beginning) of the function containing the search hit.  When you try
that again in another session without evaluating the snippet, Emacs
centers the search hit in the window, giving you less useful context.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 5 Mar 2019 19:44:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 14:44:13 2019
Received: from localhost ([127.0.0.1]:33476 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1Fz1-0006CK-Ja
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2019 14:44:11 -0500
Received: from eggs.gnu.org ([209.51.188.92]:57017)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1h1Fz0-0006C8-8M
 for 34723 <at> debbugs.gnu.org; Tue, 05 Mar 2019 14:44:10 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:55772)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1h1Fyu-0006mG-Db; Tue, 05 Mar 2019 14:44:04 -0500
Received: from [176.228.60.248] (port=4375 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1h1Fyu-0006fy-0W; Tue, 05 Mar 2019 14:44:04 -0500
Date: Tue, 05 Mar 2019 21:44:01 +0200
Message-Id: <83r2blcdj2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: charles@HIDDEN
In-reply-to: <m2bm2pumo6.fsf@HIDDEN> (charles@HIDDEN)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
 <m2bm2pumo6.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Date: Tue, 05 Mar 2019 20:49:13 +0100
> From: charles@HIDDEN (Charles A. Roelli)
> CC: 34723 <at> debbugs.gnu.org
> 
> The function diff-hunk-next is defined using the macro
> easy-mmode-define-navigation, and its definition calls (recenter '(0))
> too liberally.  The call also ignores settings like
> 'scroll-conservatively'.  The display engine is not at fault, and we
> should be able to fix the issue either in easy-mmode or in diff-mode.

I don't understand what calling 'recenter' has to do with
scroll-conservatively.  And scroll-conservatively is implemented in
the display engine, so I'm afraid I'm still in the dark regarding the
nature of the problem you are discussing.

Of course, if you know what to do to fix the problem, there's no need
for me to understand the issue, and I should just shut up and let you
do what you think is right.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 5 Mar 2019 19:37:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 14:37:14 2019
Received: from localhost ([127.0.0.1]:33471 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1FsH-000610-Qj
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2019 14:37:14 -0500
Received: from nestroy.aurox.ch ([82.195.237.20]:35006)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h1FsF-00060k-CX
 for 34723 <at> debbugs.gnu.org; Tue, 05 Mar 2019 14:37:12 -0500
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44DRwx2Sv4zlps
 for <34723 <at> debbugs.gnu.org>; Tue,  5 Mar 2019 19:37:05 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1551814623; x=1554406624; bh=0
 TJWtsK43LWXafFE9u3aV4NpzDfwyLI2JLF7A9YA6Bw=; b=iM0OZPpD+cD26dZVD
 xqiEZdgyqxbm9ZrdPiUyYnfE+re8k4cd29Lbp+Fs2GFp5ulk7wFPP7QdsDOtsg8o
 n4WNdOaRwtWL+InnZx0oEMgPKoFbVKMrn+YG81AX2GCIGw//LftefZA9QcRfAB8e
 eP3kyRE1RiNrhraSwFefX7OYHk=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id BlwKwJjW6GDK for <34723 <at> debbugs.gnu.org>;
 Tue,  5 Mar 2019 19:37:03 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44DRwv3pqVzlpd;
 Tue,  5 Mar 2019 19:37:03 +0000 (UTC)
Date: Tue, 05 Mar 2019 20:49:13 +0100
Message-Id: <m2bm2pumo6.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <8336o1e33w.fsf@HIDDEN> (message from Eli Zaretskii on Tue, 05
 Mar 2019 17:46:11 +0200)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <8336o1e33w.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 05 Mar 2019 17:46:11 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> CC: 34723 <at> debbugs.gnu.org
> 
> I've read this description and that in bug#32991, several times, and I
> still cannot figure out whether you are saying that there's a problem
> in recentering per se (and in the related redisplay code), or you are
> saying that diff-mode does something in its application code that
> indirectly and inadvertently causes unwarranted recentering.  Could
> you please clarify which is the case here?  Depending on that, the
> solution should be either in diff-mode or in the display engine
> (however, I have hard time believing that we have use cases where the
> display engine ignores scroll-related variables).
> 
> Thanks.

The function diff-hunk-next is defined using the macro
easy-mmode-define-navigation, and its definition calls (recenter '(0))
too liberally.  The call also ignores settings like
'scroll-conservatively'.  The display engine is not at fault, and we
should be able to fix the issue either in easy-mmode or in diff-mode.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 5 Mar 2019 16:12:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 11:12:16 2019
Received: from localhost ([127.0.0.1]:33367 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1Cfv-0006tG-OJ
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2019 11:12:15 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58732)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1h1Cfu-0006sz-A1
 for 34723 <at> debbugs.gnu.org; Tue, 05 Mar 2019 11:12:14 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52135)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1h1Cfi-00032o-QS; Tue, 05 Mar 2019 11:12:07 -0500
Received: from [176.228.60.248] (port=2910 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1h1Cff-0005rS-OG; Tue, 05 Mar 2019 11:12:01 -0500
Date: Tue, 05 Mar 2019 18:11:57 +0200
Message-Id: <83y35tcnci.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: charles@HIDDEN
In-reply-to: <m2d0n6v4re.fsf@HIDDEN> (charles@HIDDEN)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <87o96rprs3.fsf@HIDDEN>
 <m2d0n6v4re.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Date: Mon, 04 Mar 2019 20:06:13 +0100
> From: charles@HIDDEN (Charles A. Roelli)
> Cc: 34723 <at> debbugs.gnu.org
> 
> >   (setq isearch-push-state-function
> >         (lambda ()
> >           (when (and isearch-success (not (pos-visible-in-window-p)))
> >             (reposition-window))
> >           `(lambda (cmd)
> >              (when isearch-success
> >                (set-window-start nil ,(window-start))))))
> 
> Can we add something like this to isearch.el, maybe as a defcustom?
> Or maybe we could add it in a way such that other packages that show
> search results (grep, xref) could use the same function to reposition
> the window.  The function could inspect a defcustom in simple.el to
> decide whether (or how) to reposition the window.

Isn't it easier to temporarily bind scroll-margin to a non-zero value,
then force redisplay?

Or maybe I'm missing something in this discussion.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 5 Mar 2019 15:46:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 10:46:22 2019
Received: from localhost ([127.0.0.1]:33345 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h1CGs-0006C5-F8
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2019 10:46:22 -0500
Received: from eggs.gnu.org ([209.51.188.92]:52579)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1h1CGp-0006Bq-4g
 for 34723 <at> debbugs.gnu.org; Tue, 05 Mar 2019 10:46:19 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:51605)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1h1CGj-0007lY-IT; Tue, 05 Mar 2019 10:46:13 -0500
Received: from [176.228.60.248] (port=1301 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1h1CGj-0001Zr-6L; Tue, 05 Mar 2019 10:46:13 -0500
Date: Tue, 05 Mar 2019 17:46:11 +0200
Message-Id: <8336o1e33w.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: charles@HIDDEN
In-reply-to: <m2imwzvgld.fsf@HIDDEN> (charles@HIDDEN)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Date: Sun, 03 Mar 2019 21:38:22 +0100
> From: charles@HIDDEN (Charles A. Roelli)
> 
> In Bug#32991 we touched on diff-mode conditionally recentering when
> you use diff-hunk-next or diff-hunk-prev.  We found that this behavior
> does not respect scroll-related variables (though Stefan suggested we
> might be able to recenter while taking into account these variables).
> It would be nice to allow disabling the behavior.
> 
> There are also cases where the diff-mode recentering ends up showing
> less of the hunk than would have been displayed without the
> recentering, which must be a bug.  In general, I don't understand why
> recentering is thought to "show more" of a hunk in a buffer, when it
> might show either less or more of a hunk in a buffer.
> 
> For example, if you look at the diff of commit 7523a9e in a
> single-window GUI frame in master (emacs -Q), and type
> 
> M-: (set-frame-height (selected-frame) 15) RET
> M-g c 450 RET
> C-l C-l n
> 
> Emacs recenters and shows less of the hunk that you moved to.  This is
> contrived, but is something you might come across a lot in small
> windows, especially with longer hunks.
> 
> As a solution we could make C-M-l (reposition-window) work in
> diff-mode and call that instead from diff-hunk-next and
> diff-hunk-prev, with some customizable variable to enable or disable
> the behavior.  Or fix the recentering code to stop recentering in
> cases like the above.

I've read this description and that in bug#32991, several times, and I
still cannot figure out whether you are saying that there's a problem
in recentering per se (and in the related redisplay code), or you are
saying that diff-mode does something in its application code that
indirectly and inadvertently causes unwarranted recentering.  Could
you please clarify which is the case here?  Depending on that, the
solution should be either in diff-mode or in the display engine
(however, I have hard time believing that we have use cases where the
display engine ignores scroll-related variables).

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 4 Mar 2019 21:25:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 04 16:25:22 2019
Received: from localhost ([127.0.0.1]:60305 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h0v5N-0000eE-VK
	for submit <at> debbugs.gnu.org; Mon, 04 Mar 2019 16:25:22 -0500
Received: from lavender.maple.relay.mailchannels.net ([23.83.214.99]:54354)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1h0v5M-0000e6-50
 for 34723 <at> debbugs.gnu.org; Mon, 04 Mar 2019 16:25:20 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id A09823E5044;
 Mon,  4 Mar 2019 21:25:18 +0000 (UTC)
Received: from pdx1-sub0-mail-a28.g.dreamhost.com (unknown [100.96.19.254])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 410053E4FA0;
 Mon,  4 Mar 2019 21:25:18 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a28.g.dreamhost.com (pop.dreamhost.com
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.16.3); Mon, 04 Mar 2019 21:25:18 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Towering-Plucky: 67097acb3aa00b5e_1551734718421_3921365546
X-MC-Loop-Signature: 1551734718421:770843237
X-MC-Ingress-Time: 1551734718420
Received: from pdx1-sub0-mail-a28.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a28.g.dreamhost.com (Postfix) with ESMTP id 2EF7F80531;
 Mon,  4 Mar 2019 13:25:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=RWoj2zKHKg7H01Bu+3qjDB0OEu8=; b=
 SG5ed29JdtKgW7kDPH7jPKEela9NTK/MTmNw2rY4v6gTeSGNLnk9p7JwXXxIYbg7
 R1rKvASY+WXrgnUxqCk7z0FeflALDZvrbzHbJ8RDSCESFNl6A3rsxFDvPSBFRIaJ
 TORd5nkR+zSqIZn+ASwnHz0Z5zmSLnssgwMS2KAr+yQ=
Received: from mail.jurta.org (m91-129-98-103.cust.tele2.ee [91.129.98.103])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a28.g.dreamhost.com (Postfix) with ESMTPSA id E42748052E;
 Mon,  4 Mar 2019 13:25:12 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a28
From: Juri Linkov <juri@HIDDEN>
To: charles@HIDDEN (Charles A. Roelli)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
Organization: LINKOV.NET
References: <m2imwzvgld.fsf@HIDDEN> <87o96rprs3.fsf@HIDDEN>
 <m2d0n6v4re.fsf@HIDDEN>
Date: Mon, 04 Mar 2019 23:12:48 +0200
In-Reply-To: <m2d0n6v4re.fsf@HIDDEN> (Charles A. Roelli's message of "Mon,
 04 Mar 2019 20:06:13 +0100")
Message-ID: <87ef7ms5rj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrfedugddugeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrdelkedruddtfeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdelkedruddtfedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegthhgrrhhlvghssegruhhrohigrdgthhenucevlhhushhtvghrufhiiigvpedt
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Can we add something like this to isearch.el, maybe as a defcustom?
> Or maybe we could add it in a way such that other packages that show
> search results (grep, xref) could use the same function to reposition
> the window.  The function could inspect a defcustom in simple.el to
> decide whether (or how) to reposition the window.

Yes, a more common customization would be preferable.
Something at the same low level as `recenter',
maybe adding a new defcustom like `recenter-function'
to run a customized function e.g. `reposition-window'
instead of the default recentering to the middle of the screen.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 4 Mar 2019 18:54:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 04 13:54:15 2019
Received: from localhost ([127.0.0.1]:60171 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h0sj9-0005SZ-I4
	for submit <at> debbugs.gnu.org; Mon, 04 Mar 2019 13:54:15 -0500
Received: from nestroy.aurox.ch ([82.195.237.20]:59756)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h0sj6-0005SH-T5
 for 34723 <at> debbugs.gnu.org; Mon, 04 Mar 2019 13:54:14 -0500
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44Cq1m0b87zlC1
 for <34723 <at> debbugs.gnu.org>; Mon,  4 Mar 2019 18:54:04 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 references:reply-to:subject:subject:in-reply-to:to:from:from
 :message-id:date:date; s=dkim2; t=1551725643; x=1554317644; bh=j
 OX6yrxBTKFPjNyXOezMYrE93ICnUhI+wfjEfzax96o=; b=kt5AjG6QrswUW6Yuo
 W3xbUrpdnNEZE1JU1u6aGsnd2pccU87jcfd0tuhdZc8k6Tg+x7ByMfk6zNxrUF+Y
 B7Vhj6/wtqHaC2YHa8E69kQFUf/C6C5+nNpF78e/Koowyqg9aWRAbAsp46tw5tth
 piLhRj7Cq5GXnYeXz7MFhVX5Yg=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id tSWRoxDT5ixa for <34723 <at> debbugs.gnu.org>;
 Mon,  4 Mar 2019 18:54:03 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44Cq1l0GSpzlBt;
 Mon,  4 Mar 2019 18:54:02 +0000 (UTC)
Date: Mon, 04 Mar 2019 20:06:13 +0100
Message-Id: <m2d0n6v4re.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: Juri Linkov <juri@HIDDEN>
In-reply-to: <87o96rprs3.fsf@HIDDEN> (message from Juri Linkov on
 Sun, 03 Mar 2019 23:33:16 +0200)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
References: <m2imwzvgld.fsf@HIDDEN> <87o96rprs3.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Date: Sun, 03 Mar 2019 23:33:16 +0200
> 
> I use `C-M-l' (reposition-window) to recenter during search,
> and it works quite well to recenter diff hunks with
> 
>   (setq isearch-push-state-function
>         (lambda ()
>           (when (and isearch-success (not (pos-visible-in-window-p)))
>             (reposition-window))
>           `(lambda (cmd)
>              (when isearch-success
>                (set-window-start nil ,(window-start))))))

Can we add something like this to isearch.el, maybe as a defcustom?
Or maybe we could add it in a way such that other packages that show
search results (grep, xref) could use the same function to reposition
the window.  The function could inspect a defcustom in simple.el to
decide whether (or how) to reposition the window.

> but the problem is that I also have to change the default definition
> of reposition boundaries used by `C-M-l' (reposition-window)
> 
>    (add-hook 'diff-mode-hook
>              (lambda ()
>                (set (make-local-variable 'beginning-of-defun-function)
>                     #'diff-beginning-of-hunk)
>                (set (make-local-variable 'end-of-defun-function)
>                     #'diff-end-of-hunk)))
> 
> to recenter at diff hunk boundaries, not at diff file boundaries
> as defined in `diff-mode' by default, because usually there are
> much more lines covered by all file changes, and when reposition-window
> tries to fit all file changes into the screen, it puts the current line
> at the bottom line of the window, thus not showing the lower part
> of the current hunk.

I noticed this too.  If it makes sense, we should make these values of
beginning-of-defun-function and end-of-defun-function the default.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at 34723 <at> debbugs.gnu.org:


Received: (at 34723) by debbugs.gnu.org; 3 Mar 2019 21:38:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 03 16:38:22 2019
Received: from localhost ([127.0.0.1]:58741 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h0YoP-0005YF-Nl
	for submit <at> debbugs.gnu.org; Sun, 03 Mar 2019 16:38:21 -0500
Received: from eastern.maple.relay.mailchannels.net ([23.83.214.55]:45372)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1h0YoN-0005Y5-FO
 for 34723 <at> debbugs.gnu.org; Sun, 03 Mar 2019 16:38:20 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id CD34C5E33C9;
 Sun,  3 Mar 2019 21:38:17 +0000 (UTC)
Received: from pdx1-sub0-mail-a51.g.dreamhost.com (unknown [100.96.29.216])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 8D4CE5E20ED;
 Sun,  3 Mar 2019 21:38:17 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a51.g.dreamhost.com (pop.dreamhost.com
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.16.3); Sun, 03 Mar 2019 21:38:17 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Harbor-Irritate: 3a23cbb54f73958d_1551649097699_391423197
X-MC-Loop-Signature: 1551649097698:1055920230
X-MC-Ingress-Time: 1551649097698
Received: from pdx1-sub0-mail-a51.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a51.g.dreamhost.com (Postfix) with ESMTP id 3724E800C6;
 Sun,  3 Mar 2019 13:38:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=gtr19QhTXNFYL7Q3rNYdkgfTewQ=; b=
 KfYeZy8071IdE8Mdo+MmXqGXdtQHeUOZs/5TUUK+3EERDlid7JWUppdcwXeEztn+
 MXjP7fiUWGK9hCH2RCqW2YASQsgLULfDIZduvr89G+vFUs6x/HVTkOh15Nw1cOZy
 5WmOHmv9rYV9mc8Dz89en0dfr3V5geBuSErj6b8sxE4=
Received: from mail.jurta.org (m91-129-98-103.cust.tele2.ee [91.129.98.103])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a51.g.dreamhost.com (Postfix) with ESMTPSA id 5D2A9800C3;
 Sun,  3 Mar 2019 13:38:14 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a51
From: Juri Linkov <juri@HIDDEN>
To: charles@HIDDEN (Charles A. Roelli)
Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering
Organization: LINKOV.NET
References: <m2imwzvgld.fsf@HIDDEN>
Date: Sun, 03 Mar 2019 23:33:16 +0200
In-Reply-To: <m2imwzvgld.fsf@HIDDEN> (Charles A. Roelli's message of "Sun,
 03 Mar 2019 21:38:22 +0100")
Message-ID: <87o96rprs3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrvdelgdduheduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrdelkedruddtfeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdelkedruddtfedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegthhgrrhhlvghssegruhhrohigrdgthhenucevlhhushhtvghrufhiiigvpedu
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 34723
Cc: 34723 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> As a solution we could make C-M-l (reposition-window) work in
> diff-mode and call that instead from diff-hunk-next and
> diff-hunk-prev, with some customizable variable to enable or disable
> the behavior.  Or fix the recentering code to stop recentering in
> cases like the above.

I use `C-M-l' (reposition-window) to recenter during search,
and it works quite well to recenter diff hunks with

  (setq isearch-push-state-function
        (lambda ()
          (when (and isearch-success (not (pos-visible-in-window-p)))
            (reposition-window))
          `(lambda (cmd)
             (when isearch-success
               (set-window-start nil ,(window-start))))))

but the problem is that I also have to change the default definition
of reposition boundaries used by `C-M-l' (reposition-window)

   (add-hook 'diff-mode-hook
             (lambda ()
               (set (make-local-variable 'beginning-of-defun-function)
                    #'diff-beginning-of-hunk)
               (set (make-local-variable 'end-of-defun-function)
                    #'diff-end-of-hunk)))

to recenter at diff hunk boundaries, not at diff file boundaries
as defined in `diff-mode' by default, because usually there are
much more lines covered by all file changes, and when reposition-window
tries to fit all file changes into the screen, it puts the current line
at the bottom line of the window, thus not showing the lower part
of the current hunk.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Mar 2019 20:32:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 03 15:32:10 2019
Received: from localhost ([127.0.0.1]:58717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1h0XmM-00021h-DE
	for submit <at> debbugs.gnu.org; Sun, 03 Mar 2019 15:32:10 -0500
Received: from eggs.gnu.org ([209.51.188.92]:59530)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charles@HIDDEN>) id 1h0XmK-00021T-CJ
 for submit <at> debbugs.gnu.org; Sun, 03 Mar 2019 15:32:09 -0500
Received: from lists.gnu.org ([209.51.188.17]:41531)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <charles@HIDDEN>) id 1h0XmF-0002Ah-4J
 for submit <at> debbugs.gnu.org; Sun, 03 Mar 2019 15:32:03 -0500
Received: from eggs.gnu.org ([209.51.188.92]:45676)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <charles@HIDDEN>) id 1h0XmE-0003Sc-79
 for bug-gnu-emacs@HIDDEN; Sun, 03 Mar 2019 15:32:02 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_MED,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <charles@HIDDEN>) id 1h0XmD-00029a-DZ
 for bug-gnu-emacs@HIDDEN; Sun, 03 Mar 2019 15:32:02 -0500
Received: from nestroy.aurox.ch ([82.195.237.20]:53860)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <charles@HIDDEN>) id 1h0XmC-0001nR-Q7
 for bug-gnu-emacs@HIDDEN; Sun, 03 Mar 2019 15:32:01 -0500
Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1])
 by nestroy.aurox.ch (Postfix) with ESMTP id 44CF6m5mbtzkfV
 for <bug-gnu-emacs@HIDDEN>; Sun,  3 Mar 2019 20:26:24 +0000 (UTC)
Authentication-Results: nestroy.aurox.ch (amavisd-new);
 dkim=pass (1024-bit key) reason="pass (just generated, assumed good)"
 header.d=aurox.ch
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h=
 reply-to:subject:subject:to:from:from:message-id:date:date; s=
 dkim2; t=1551644784; x=1554236785; bh=KFa8CTVFfJVNPJfwAjE2J6K9EU
 m/uDDVQ7cgOSRQl1k=; b=DaNsjQeWLJHz88lA/TE8NLYmV5pN4rQlA0mguNKKlP
 iekrauaKTO5iSp8aEMRrRXBVhagcLhn2fDVmJG5HaDBJKPrkOuIJEQDi3DmTSeaq
 /B/u4eW9959uK+XCRvJb0UHHkS0+iDJOvQRs3lrXEuLo/hx6ZojJcU39LMNMk716
 0=
X-Virus-Scanned: Debian amavisd-new at nestroy.aurox.ch
Received: from nestroy.aurox.ch ([127.0.0.1])
 by nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id RBcZOlRwkVvq for <bug-gnu-emacs@HIDDEN>;
 Sun,  3 Mar 2019 20:26:24 +0000 (UTC)
Received: from gray (unknown [IPv6:2a02:1206:4512:5f50:c62c:3ff:fe30:b864])
 by nestroy.aurox.ch (Postfix) with ESMTPSA id 44CF6l67VMzkfN
 for <bug-gnu-emacs@HIDDEN>; Sun,  3 Mar 2019 20:26:23 +0000 (UTC)
Date: Sun, 03 Mar 2019 21:38:22 +0100
Message-Id: <m2imwzvgld.fsf@HIDDEN>
From: charles@HIDDEN (Charles A. Roelli)
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; customize and improve diff-mode recentering 
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 82.195.237.20
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: charles@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

In Bug#32991 we touched on diff-mode conditionally recentering when
you use diff-hunk-next or diff-hunk-prev.  We found that this behavior
does not respect scroll-related variables (though Stefan suggested we
might be able to recenter while taking into account these variables).
It would be nice to allow disabling the behavior.

There are also cases where the diff-mode recentering ends up showing
less of the hunk than would have been displayed without the
recentering, which must be a bug.  In general, I don't understand why
recentering is thought to "show more" of a hunk in a buffer, when it
might show either less or more of a hunk in a buffer.

For example, if you look at the diff of commit 7523a9e in a
single-window GUI frame in master (emacs -Q), and type

M-: (set-frame-height (selected-frame) 15) RET
M-g c 450 RET
C-l C-l n

Emacs recenters and shows less of the hunk that you moved to.  This is
contrived, but is something you might come across a lot in small
windows, especially with longer hunks.

As a solution we could make C-M-l (reposition-window) work in
diff-mode and call that instead from diff-hunk-next and
diff-hunk-prev, with some customizable variable to enable or disable
the behavior.  Or fix the recentering code to stop recentering in
cases like the above.




Acknowledgement sent to charles@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#34723; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.