[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34723: 27.0.50; customize and improve diff-mode recentering
From: |
Juri Linkov |
Subject: |
bug#34723: 27.0.50; customize and improve diff-mode recentering |
Date: |
Sun, 03 Mar 2019 23:33:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
> 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.
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Charles A. Roelli, 2019/03/03
- bug#34723: 27.0.50; customize and improve diff-mode recentering,
Juri Linkov <=
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Charles A. Roelli, 2019/03/04
- bug#34723: 27.0.50; customize and improve diff-mode recentering, Juri Linkov, 2019/03/04
- 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/07
bug#34723: 27.0.50; customize and improve diff-mode recentering, Eli Zaretskii, 2019/03/05