bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Alan Mackenzie
Subject: bug#17453: Isearch doesn't work properly with Follow Mode.
Date: Sun, 11 May 2014 12:58:42 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hello, Stefan.

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.

Follow Mode knows nothing of Isearch.  The problem the other way round is
in Lisp files that themselves play with redisplay (including calling
`sit-for') and `set-window-start', and so on.  Between these invocations
and the actual redisplay, Follow Mode must get a chance to make its
adjustments.

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

For what?

Given that Follow Mode uses a list of windows where most elisp programs
(including Isearch up till now) are expecting to deal with a single
window, there is quite a large clash, possibly unbridgeable with any
reasonable amount of effort.  Some sort of abstraction that smoothes over
the difference between the window and the window list is difficult to
conceive of - Follow Mode itself is such an abstraction.

Maybe a useful hook here would be `redisplay-hook' where Follow Mode
could do its stuff more effectively than on `post-command-hook'.

The extreme solution would be to enhance the display code to handle
multiple column windows, rendering Follow Mode redundant.  I don't think
anybody with the expertise has the time for this.

> > @@ -2207,10 +2239,12 @@
> >  together with as much of the search string as will fit; the symbol
> >  `above' if we need to scroll the text downwards; the symbol `below',
> >  if upwards."
> > -  (let ((w-start (window-start))
> > -        (w-end (window-end nil t))
> > -        (w-L1 (save-excursion (move-to-window-line 1) (point)))
> > -        (w-L-1 (save-excursion (move-to-window-line -1) (point)))
> > +  (let ((w-start (isearch-windows-start))
> > +   (w-end (isearch-windows-end nil t))
> > +        (w-L1 (with-selected-window (car isearch-windows)
> > +           (save-excursion (move-to-window-line 1) (point))))
> > +        (w-L-1 (with-selected-window (car (last isearch-windows))
> > +            (save-excursion (move-to-window-line -1) (point))))

> This isearch-string-out-of-window+isearch-back-into-window business, for
> example should be generalized to a function along the lines of
> "bring-region-into-sight".  It's not useful only for isearch.

This seems to be a different bug to the one I reported, and orthogonal to
it.

> E.g. ediff-next-hunk would also benefit from it.

Not necessarily.  isearch-back-into-window, in addition to doing
"bring-region-into-sight" ensures that it's the isearch-point end of it
which is visible when it is too big for the window.  This may be
problematic for other uses, like in ediff.

> And of course, it should come with a bring-region-into-sight-function
> hook (which does not default to nil but to the default implementation),
> which follow-mode can then override.

Yes.

Question is, what about the main bug?  The patch I wrote fixes a real
bug, and works (modulo any remaining bugs).  Do you have any concrete
suggestions as to how to improve the fix?

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

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