[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34723: 27.0.50; customize and improve diff-mode recentering
From: |
Stefan Monnier |
Subject: |
bug#34723: 27.0.50; customize and improve diff-mode recentering |
Date: |
Wed, 13 Mar 2019 15:56:50 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> 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)
- bug#34723: 27.0.50; customize and improve diff-mode recentering, (continued)
bug#34723: 27.0.50; customize and improve diff-mode recentering, Eli Zaretskii, 2019/03/05
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Charles A. Roelli, 2019/03/05
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Eli Zaretskii, 2019/03/05
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Charles A. Roelli, 2019/03/05
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Eli Zaretskii, 2019/03/06
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Charles A. Roelli, 2019/03/07
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Stefan Monnier, 2019/03/13
- bug#34723: 27.0.50; customize and improve diff-mode recentering,
Stefan Monnier <=
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Charles A. Roelli, 2019/03/16
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Stefan Monnier, 2019/03/16
bug#34723: 27.0.50; customize and improve diff-mode recentering, Charles A. Roelli, 2019/03/16
bug#34723: 27.0.50; customize and improve diff-mode recentering, Stefan Monnier, 2019/03/22