Subject: bug#17453: Isearch doesn't work properly with Follow Mode.

From: Alan Mackenzie <[email-masked]>
Date: Thu, 29 Oct 2015 23:23:02 +0000

Hello, Stefan, hello, Emacs.

Resuming a conversation from a year and a half ago, in it I had proposed
a patch which made isearch work properly in a Follow Mode set of
windows.  In the end, you rejected my patch (in effect), because...

On Fri, May 09, 2014 at 10:40:07PM -0400, Stefan Monnier wrote:

> I must say I really dislike this hard-coding of follow-mode support in
> isearch.el.  Isearch should not know so much about follow-mode and
> follow-mode should not know so much about Isearch either.

> IOW we should try harder to come up with more general hooks.

That irritated me at the time, but you were right - putting Follow Mode
support directly into isearch would not have been a good idea.

I've recently started working on the bug again, and although it's not
your job anymore, I'd still appreciate you giving me some feedback on my
new approach.

What I propose is that several functions which operate on windows have
extended versions which operate on @dfn{groups of windows}, this meaning
(for the moment) Follow Mode groups of windows.  These new functions are
flexible enough to work with methods other than Follow Mode of grouping
windows, should such ever be implemented.

The new functions are window*-start, window*-end, set-window*-start,
recenter*, pos-visible-in-window*-p, move-to-window*-line, and sit*-for.

window*-start returns the window-start of the _first_ window in the
group, window*-end returns the window-end of the _last_ window in the
group, and so on, all these functions doing the Right Thing for a group
of windows.  sit*-for exists, because Follow Mode needs a chance to
resynchronise its windows before redisplay happens.

If Follow Mode is not enabled, all the above functions do the Right
Thing on the single window.

In addition, there is a function window*-windows, which returns an
ordered list of the windows involved (or a list of the single window
when F.M. is not active).

I have a trial implementation of the above, and a trial adaptation of
isearch.el which uses it.  It works.

What do you think?

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).