From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: 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 1446465198 7151 80.91.229.3 (2 Nov 2015 11:53:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Nov 2015 11:53:18 +0000 (UTC) Cc: 17453@debbugs.gnu.org, emacs-devel , Stefan Monnier , Juri Linkov To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 02 12:53:17 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZtDfp-0008JI-B8 for ged-emacs-devel@m.gmane.org; Mon, 02 Nov 2015 12:53:17 +0100 Original-Received: from localhost ([::1]:41522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtDfo-0000rq-Jf for ged-emacs-devel@m.gmane.org; Mon, 02 Nov 2015 06:53:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtDfk-0000rZ-Gy for emacs-devel@gnu.org; Mon, 02 Nov 2015 06:53:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtDfj-00005t-Lb for emacs-devel@gnu.org; Mon, 02 Nov 2015 06:53:12 -0500 Original-Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]:35238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtDfj-00005O-F2 for emacs-devel@gnu.org; Mon, 02 Nov 2015 06:53:11 -0500 Original-Received: by lbbes7 with SMTP id es7so86160113lbb.2 for ; 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-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::234 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:193104 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.