all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: charles@aurox.ch (Charles A. Roelli)
To: Juri Linkov <juri@linkov.net>
Cc: 34723@debbugs.gnu.org
Subject: bug#34723: 27.0.50; customize and improve diff-mode recentering
Date: Mon, 04 Mar 2019 20:06:13 +0100	[thread overview]
Message-ID: <m2d0n6v4re.fsf@aurox.ch> (raw)
In-Reply-To: <87o96rprs3.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 03 Mar 2019 23:33:16 +0200)

> From: Juri Linkov <juri@linkov.net>
> 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.





  reply	other threads:[~2019-03-04 19:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-03 20:38 bug#34723: 27.0.50; customize and improve diff-mode recentering Charles A. Roelli
2019-03-03 21:33 ` Juri Linkov
2019-03-04 19:06   ` Charles A. Roelli [this message]
2019-03-04 21:12     ` Juri Linkov
2019-03-05 16:11     ` Eli Zaretskii
2019-03-05 20:11       ` Charles A. Roelli
2019-03-05 20:22         ` Eli Zaretskii
2019-03-07 19:12           ` Charles A. Roelli
2019-03-05 15:46 ` Eli Zaretskii
2019-03-05 19:49   ` Charles A. Roelli
2019-03-05 19:44     ` Eli Zaretskii
2019-03-05 20:37       ` Charles A. Roelli
2019-03-06 16:06         ` Eli Zaretskii
2019-03-07 19:49           ` Charles A. Roelli
2019-03-13 19:40             ` Stefan Monnier
2019-03-13 19:56               ` Stefan Monnier
2019-03-16 19:39                 ` Charles A. Roelli
2019-03-16 22:37                   ` Stefan Monnier
2019-03-16 20:21               ` Charles A. Roelli
2019-03-22 19:32                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2d0n6v4re.fsf@aurox.ch \
    --to=charles@aurox.ch \
    --cc=34723@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.