From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.bugs Subject: bug#17453: Isearch doesn't work properly with Follow Mode. Date: Mon, 2 Nov 2015 11:53:10 +0000 Message-ID: References: <20140509224458.GA4205@acm.acm> <20151029232302.GB3812@acm.fritz.box> <87h9l6627a.fsf@mail.linkov.net> <20151031235651.GE1853@acm.fritz.box> <87bnbddzpk.fsf@mail.linkov.net> <20151102092853.GA11804@acm.fritz.box> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1446465264 8186 80.91.229.3 (2 Nov 2015 11:54:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Nov 2015 11:54:24 +0000 (UTC) Cc: Juri Linkov , 17453@debbugs.gnu.org, Stefan Monnier , emacs-devel To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 02 12:54:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZtDgj-0000ZX-R0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Nov 2015 12:54:14 +0100 Original-Received: from localhost ([::1]:41526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtDgj-0001KF-6Q for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Nov 2015 06:54:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtDgd-0001K9-P9 for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 06:54:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtDgZ-0000X4-L4 for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 06:54:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtDgZ-0000X0-FH for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 06:54:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZtDgZ-0007W5-4X for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 06:54:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Nov 2015 11:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17453 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17453-submit@debbugs.gnu.org id=B17453.144646519428806 (code B ref 17453); Mon, 02 Nov 2015 11:54:02 +0000 Original-Received: (at 17453) by debbugs.gnu.org; 2 Nov 2015 11:53:14 +0000 Original-Received: from localhost ([127.0.0.1]:48557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZtDfl-0007UY-Fz for submit@debbugs.gnu.org; Mon, 02 Nov 2015 06:53:13 -0500 Original-Received: from mail-lb0-f169.google.com ([209.85.217.169]:35573) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZtDfj-0007UN-DS for 17453@debbugs.gnu.org; Mon, 02 Nov 2015 06:53:12 -0500 Original-Received: by lbbes7 with SMTP id es7so86160112lbb.2 for <17453@debbugs.gnu.org>; Mon, 02 Nov 2015 03:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=oyBG3iZQdJZxU1JJi9YqCIvO+A39dlROTAkwOCJ5cAI=; b=sf/r6vJ0riO6FmHVTL43ullPPcCiSe/vXkSYmOWaHgrWogdj4mBFgtrCKu9aW/9Q8I xt1FDE8tOH454R7GnZOqM8RkzpFLiRJYjCl09O8XWZsRIT7z3QAwMr2WNSamoQSY/6P/ g9Ju6+4B9yXS7ANlvBsWdGZExfyp/gQqeRkmKgmcg8KIM0d7AbEGCfWIUDzLcdHYTYbJ ZWvBjtGwsS9fwQUOBNtIIp9UN07l+r0uhtCg+OClVkD0XhXr3w/M4ttJ+1UJ0IHwXeDH Qmq0S3anuNytGDQXwio65GfUuHHIxN6lp9dqyDlsztU7/5wkxVBttFATOfLDNmCpTd4l hjlA== X-Received: by 10.112.157.105 with SMTP id wl9mr3991726lbb.2.1446465190399; Mon, 02 Nov 2015 03:53:10 -0800 (PST) Original-Received: by 10.112.63.71 with HTTP; Mon, 2 Nov 2015 03:53:10 -0800 (PST) In-Reply-To: <20151102092853.GA11804@acm.fritz.box> X-Google-Sender-Auth: t6Cj2BwaavhWlnK5vHXFfpzw1DA X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:108295 Archived-At: > 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 =E2=80=9Chighlighting matches on all windows=E2=80=9D 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.