emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eli Zaretskii
Subject: Re: bug#17453: Isearch doesn't work properly with Follow Mode.
Date: Sun, 01 Nov 2015 22:54:21 +0200

> Date: Sun, 1 Nov 2015 18:27:33 +0000
> Cc: address@hidden, address@hidden
> From: Alan Mackenzie <address@hidden>
> 
> > How is this "not having isearch know about Follow mode"?  I see that
> > knowledge on every step of this patch, whenever you call the new
> > functions.
> 
> It has no knowledge of the internals of Follow Mode.

But the window*-* functions do.  And any code that calls them _knows_
about Follow mode.

Maybe it's just me, but I see no real difference in having the Follow
mode explicitly called out in a separate function, instead in
isearch.el itself.

> The new patch doesn't insert things like this into isearch.el:
> 
> +             (if (and (boundp 'follow-mode) follow-mode)
> +                (progn (follow-adjust-window (selected-window))
> +                       t)

It inserts them indirectly via calling special functions.  Which means
a package cannot really be oblivious to Follow mode's existence.

> > I thought you will come up with some more generic framework for
> > commands to "scroll" the display by switching to the next window (when
> > under Follow mode), if possible.  But unless I'm missing something
> > very important, this isn't that framework, is it?
> 
> Follow Mode itself choses which window to leave point in.  For example,
> if isearch started in the left hand window, FM will place point in the
> RH window if the first match is there.

That's not what I see.  What I see is that starting Isearch in the
left window scrolls that window, and then the right window scrolls
accordingly.  What I'd expect (if I were a user of Follow mode) us an
automatic switch to the right window, and scroll only when that window
is also exhausted.  That doesn't happen, at least not with the current
master.

In any case, what I thought you'd do is introduce a bunch of
variables, such as window-selection-for-scroll-function, that will
allow Follow mode to override the default (trivial) value and dictate
its own decisions to its clients.  Or something like that.

> window*-start and friends do constitute a generic framework.

No, a generic framework would be, for example, to have a variable
whose value is a function, and let Follow mode override the default
value.

> > Btw, I see no reason to introduce new functions.  Instead, we could
> > have the original ones accept an additional optional argument.
> 
> We could.  But that might make these functions less "pure": as well as
> doing what they do, they would also have to execute some call-out to
> Follow Mode in some fashion.

Isn't that what window*-* functions do anyway?  Where's the benefit?

> > You are right about not relying on the list, but window-next-sibling
> > and window-prev-sibling are available, and always will be, so you can
> > "trivially" use them instead of relying on a list.
> 
> The next/previous sibling might be displaying a different buffer.

But that's very easy to test, no?

> to use window-next/previous-sibling properly would mean some fairly
> extensive changes to the innards of Follow Mode - FM has its own
> left-to-right, top-to-bottom algorithm for ordering its windows.

What algorithm could that be, if not something that traverses the
window tree in some order?

> > If you agree, then John's question still stands, I think.
> 
> The "car of a list of windows" he was talking about means that list of
> windows needs to come from somewhere.  The list is maintained by Follow
> Mode, really only available using an internal FM function.  As soon as
> we use this, we have coupled isearch with Follow Mode more tightly.
> This is undesirable.

Not if you go through a variable whose default value Follow mode can
override.  Or some other decoupling technique like that, I'm sure
there are more, perhaps more elegant ones.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]