From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#17453: Isearch doesn't work properly with Follow Mode. Date: Fri, 09 May 2014 22:40:07 -0400 Message-ID: References: <20140509224458.GA4205@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1399689689 7696 80.91.229.3 (10 May 2014 02:41:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 May 2014 02:41:29 +0000 (UTC) Cc: 17453@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 10 04:41:21 2014 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 1WixE1-0000Tf-Gy for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 May 2014 04:41:21 +0200 Original-Received: from localhost ([::1]:55208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WixE0-00054x-Oo for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 May 2014 22:41:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WixDr-000541-5D for bug-gnu-emacs@gnu.org; Fri, 09 May 2014 22:41:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WixDj-00016O-M3 for bug-gnu-emacs@gnu.org; Fri, 09 May 2014 22:41:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WixDj-00016K-JE for bug-gnu-emacs@gnu.org; Fri, 09 May 2014 22:41:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WixDj-0005ja-1t for bug-gnu-emacs@gnu.org; Fri, 09 May 2014 22:41:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 May 2014 02:41: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.139968962021986 (code B ref 17453); Sat, 10 May 2014 02:41:02 +0000 Original-Received: (at 17453) by debbugs.gnu.org; 10 May 2014 02:40:20 +0000 Original-Received: from localhost ([127.0.0.1]:57443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WixD0-0005iW-Nh for submit@debbugs.gnu.org; Fri, 09 May 2014 22:40:19 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:31065) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WixCv-0005iE-E7 for 17453@debbugs.gnu.org; Fri, 09 May 2014 22:40:13 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVNMCqwB/2dsb2JhbABZgwaDSr0vgw6BFxd0giYBAQRWIxALDiYSFBgNJIgM0hkXjnoHhDgEqRmBaoNMIQ X-IPAS-Result: ArYGAIDvNVNMCqwB/2dsb2JhbABZgwaDSr0vgw6BFxd0giYBAQRWIxALDiYSFBgNJIgM0hkXjnoHhDgEqRmBaoNMIQ X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="62185951" Original-Received: from 76-10-172-1.dsl.teksavvy.com (HELO pastel.home) ([76.10.172.1]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 09 May 2014 22:40:07 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 9762360792; Fri, 9 May 2014 22:40:07 -0400 (EDT) In-Reply-To: <20140509224458.GA4205@acm.acm> (Alan Mackenzie's message of "Fri, 9 May 2014 22:44:58 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) 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: 140.186.70.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:88846 Archived-At: > +(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