From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#34723: 27.0.50; customize and improve diff-mode recentering Date: Wed, 13 Mar 2019 15:56:50 -0400 Message-ID: References: <8336o1e33w.fsf@gnu.org> <83r2blcdj2.fsf@gnu.org> <83h8cgc7ih.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="228840"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 34723@debbugs.gnu.org To: charles@aurox.ch (Charles A. Roelli) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 13 20:57:17 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 1h4A01-000xNV-Gh for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Mar 2019 20:57:13 +0100 Original-Received: from localhost ([127.0.0.1]:50072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4A00-00061Z-H4 for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Mar 2019 15:57:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h49zr-00061U-8i for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:57:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h49zq-0005gd-Cm for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57231) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h49zq-0005gK-5H for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h49zp-0001Sz-T9 for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2019 15:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2019 19:57:01 +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.15525070195629 (code B ref 34723); Wed, 13 Mar 2019 19:57:01 +0000 Original-Received: (at 34723) by debbugs.gnu.org; 13 Mar 2019 19:56:59 +0000 Original-Received: from localhost ([127.0.0.1]:42542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h49zn-0001Si-5E for submit@debbugs.gnu.org; Wed, 13 Mar 2019 15:56:59 -0400 Original-Received: from alt24.smtp-out.videotron.ca ([70.80.0.75]:14824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h49zl-0001SW-8F for 34723@debbugs.gnu.org; Wed, 13 Mar 2019 15:56:58 -0400 Original-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 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 97F0AAEB94; Wed, 13 Mar 2019 15:56:50 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Wed, 13 Mar 2019 15:40:16 -0400") X-CMAE-Envelope: MS4wfPDCwsvMRuHYfL/00eWomL96UbZej0M0E626jT9vOnij0eaKws8ONE86JujMKUk9PZkslOTem9cASuV79yuhAPJFHSkW0DAvlY1dB8Us/11wv7Fy6nLX +c/SmpHUNmOyLe12YSZNDyYWXV6EcSkNsWWsS6cz0A17r8WMVD5OsSpm6M1eSXc3WewwaTSDQrjX9EVBfhmBdkvVhbCer9A7fR9RNDZdd70ZBKkCcbteE1lJ P3gryXsy+C9SGsdZFTcp30Qs9K3UJPsZk4jHB5crj2U= 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:156310 Archived-At: >> 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)