Subject: Re: bug#34723: 27.0.50; customize and improve diff-mode recentering

From: Eli Zaretskii <[email-masked]>
Date: Tue, 05 Mar 2019 18:11:57 +0200

> Date: Mon, 04 Mar 2019 20:06:13 +0100
> From: [email-masked] (Charles A. Roelli)
> Cc: [email-masked]
> 
> >   (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.

Isn't it easier to temporarily bind scroll-margin to a non-zero value,
then force redisplay?

Or maybe I'm missing something in this discussion.