From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: charles@aurox.ch (Charles A. Roelli) Newsgroups: gmane.emacs.bugs Subject: bug#34723: 27.0.50; customize and improve diff-mode recentering Date: Sat, 16 Mar 2019 21:21:40 +0100 Message-ID: References: <8336o1e33w.fsf@gnu.org> <83r2blcdj2.fsf@gnu.org> <83h8cgc7ih.fsf@gnu.org> Reply-To: charles@aurox.ch Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="74081"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 34723@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 16 21:09:22 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 1h5FcP-000JBO-EP for geb-bug-gnu-emacs@m.gmane.org; Sat, 16 Mar 2019 21:09:21 +0100 Original-Received: from localhost ([127.0.0.1]:45734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5FcN-0000BG-VJ for geb-bug-gnu-emacs@m.gmane.org; Sat, 16 Mar 2019 16:09:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5FcA-00008a-6c for bug-gnu-emacs@gnu.org; Sat, 16 Mar 2019 16:09:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5Fc8-0007uS-Al for bug-gnu-emacs@gnu.org; Sat, 16 Mar 2019 16:09:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33204) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h5Fc6-0007tD-KT for bug-gnu-emacs@gnu.org; Sat, 16 Mar 2019 16:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h5Fc6-0007tY-Em for bug-gnu-emacs@gnu.org; Sat, 16 Mar 2019 16:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: charles@aurox.ch (Charles A. Roelli) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Mar 2019 20:09: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.155276691230290 (code B ref 34723); Sat, 16 Mar 2019 20:09:02 +0000 Original-Received: (at 34723) by debbugs.gnu.org; 16 Mar 2019 20:08:32 +0000 Original-Received: from localhost ([127.0.0.1]:46744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5Fbc-0007sU-4B for submit@debbugs.gnu.org; Sat, 16 Mar 2019 16:08:32 -0400 Original-Received: from nestroy.aurox.ch ([82.195.237.20]:42956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5Fba-0007sC-Ok for 34723@debbugs.gnu.org; Sat, 16 Mar 2019 16:08:31 -0400 Original-Received: from nestroy.aurox.ch (nestroy.aurox.ch [127.0.0.1]) by nestroy.aurox.ch (Postfix) with ESMTP id 44MD5z6fzBzt5q for <34723@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 Original-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@debbugs.gnu.org>; Sat, 16 Mar 2019 20:08:23 +0000 (UTC) Original-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) In-reply-to: (message from Stefan Monnier on Wed, 13 Mar 2019 15:40:16 -0400) 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:156419 Archived-At: > From: Stefan Monnier > 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.