GNU bug report logs - #17453
Isearch doesn't work properly with Follow Mode.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Fri, 9 May 2014 22:50:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #74 received at 17453 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 17453 <at> debbugs.gnu.org, emacs-devel <emacs-devel <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#17453: Isearch doesn't work properly with Follow Mode.
Date: Mon, 2 Nov 2015 11:53:10 +0000
> I don't actually understand that patch, I'll need to study the wierd/new
> constructs used in it, like `when-let'.

Here's a more thoroughly explained version of this function, that
doesn't use when-let.

seq-find is equivalent to cl-find-if, it returns the first element
that matches the provided predicate.

(defun follow--search-function ()
  (lambda (&rest args)
    (let ((search-function (isearch-search-fun-default))
          (matched (apply search-function args)))
      ;; If this is a proper user-triggered search (and not just a
      ;; lazy-highlight search), and if the search matched, and if the
      ;; match is not visible on this window...
      (when (and matched
                 (not isearch-lazy-highlight-ongoing-search)
                 (not (and (pos-visible-in-window-p (match-beginning 0))
                           (pos-visible-in-window-p (match-end 0)))))
        ;; ... see if the match is visible on another window.
        (let ((win (seq-find (lambda (w)
                               (and (pos-visible-in-window-p
(match-beginning 0) w)
                                    (pos-visible-in-window-p (match-end 0) w)))
                             (follow-all-followers))))
          ;; If so, select it.
          (when win
            (select-window win))))
      matched)))

I also changed it to use (follow-all-followers).

> However, I'm certain that that patch will not fix all the problems
> discussed in this post.

The patch as provided doesn't fix the “highlighting matches on all
windows” issue. But that's trivial to solve by removing that
`(overlay-put ov 'window (selected-window))' line. (which I have half
a mind to do right now because I just think it's a generally useful
improvement.)

>  One way or another, isearch MUST work with the
> window boundaries of the entire Follow Mode group.

Maybe I missed part of the issue. I thought you wanted Isearch to
switch to another window if that window contains the next match
(instead of scrolling the current window). For that, you only need
pos-visible-in-window-p, you don't need to mess with boundaries.




This bug report was last modified 9 years and 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.