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: Stefan Monnier
Subject: bug#17453: Isearch doesn't work properly with Follow Mode.
Date: Fri, 09 May 2014 22:40:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> +(defvar isearch-windows nil
> +  "List of windows active in the incremental search.
> +This is either the ordered list of active windows administered by
> +`follow-mode' or a list of the single window involved in the
> +search.")
> +
> +(defmacro isearch-windows-start (&optional wins)
> +  "Get the start point of the windows involved in the isearch."
> +  `(window-start (car ,(if wins wins 'isearch-windows))))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          (or wins 'isearch-windows)

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.

> +  `(if isearch-message-function
> +       (funcall isearch-message-function ,cqh ,ellip)
> +     (isearch-message ,cqh ,ellip)))

Aka (funcall (or isearch-message-function #'isearch-message) ,cqh ,ellip)

BTW, isearch-message-function should be changed to default to
isearch-message rather than to nil.

> @@ -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.
E.g. ediff-next-hunk would also benefit from it.
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.

> +             ;; 1000 is higher than ediff's 100+,

[ Side note: Ediff doesn't use priorities any more.  ]


        Stefan





reply via email to

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