[Top][All Lists]

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

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

From: Alan Mackenzie
Subject: Re: bug#17453: Isearch doesn't work properly with Follow Mode.
Date: Sun, 1 Nov 2015 18:27:33 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

Hello, Eli.

On Sun, Nov 01, 2015 at 06:50:00PM +0200, Eli Zaretskii wrote:
> > Date: Sun, 1 Nov 2015 13:52:53 +0000
> > From: Alan Mackenzie <address@hidden>
> > Cc: emacs-devel <address@hidden>
> > 
> > No problem!  The patch below doesn't actually apply at the moment, due
> > to some (?very) recent change in isearch.el.  But it wouldn't run
> > anyway, because window*-start and friends aren't there yet.
> > 
> > 
> > 
> > diff --git a/lisp/isearch.el b/lisp/isearch.el
> > index 4fc9b38..07ec534 100644
> > --- a/lisp/isearch.el
> > +++ b/lisp/isearch.el

> 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.  window*-start is
merely an abstract interface, currently with two implementations
associated with it, a default one for normal windows and a Follow Mode
one.  More implementations could be added, the Follow Mode one could be
taken away.

I'm not sure I really understand your question.  At several points in
isearch, functions need to be called which eventually end up calling
Follow Mode functions.

> So maybe I'm missing something, but I really don't see why this
> variant is significantly better than the one Stefan didn't like.  Can
> you explain what am I missing here?

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)

, though the old one from eighteen months ago did.  The new patch
doesn't use any FM internal interfaces, indeed doesn't do anything
directly with FM, beyond temporarily disabling it when a "small window"
comes into effect because of a "slow terminal".

> 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.

window*-start and friends do constitute a generic framework.  Any Elisp
library can replace window-start by window*-start, etc., and it then
operates on the entire group of FM windows rather than just one window.

> 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.  The Follow Mode hook would then tell
window-start which window it _really_ should return the start of.  Maybe
this would be better, maybe it would be more messy.

> As yet another comment, wrt this exchange between you and John:

> > > What is the reason for having separate functions such as window*-start,
> > > instead of just taking the car of a list of windows?  I may be missing 
> > > some
> > > context here, but this sounds like special-casing general behavior, and 
> > > I'm
> > > wondering why it's necessary...
> > [...]
> > The fact that the "group" of windows is represented by a list is an
> > implementation detail to be encapsulated within follow.el.  In the
> > (fairly distant) future, this might perhaps be superseded by code in
> > redisplay.  Perhaps.

> 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.  This
happens quite frequently when you look up a tag with M-..  But 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.  (I'm not defending
this, by the way - it's just the way things are at the moment.)

> 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.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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