From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#17453: Isearch doesn't work properly with Follow Mode. Date: Mon, 2 Nov 2015 16:09:17 +0000 Message-ID: <20151102160917.GE11804@acm.fritz.box> 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> <20151102123512.GB11804@acm.fritz.box> <831tc8xv39.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1446480513 12041 80.91.229.3 (2 Nov 2015 16:08:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Nov 2015 16:08:33 +0000 (UTC) Cc: 17453@debbugs.gnu.org, monnier@iro.umontreal.ca, bruce.connor.am@gmail.com, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 02 17:08: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 1ZtHeV-00085B-0g for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Nov 2015 17:08:11 +0100 Original-Received: from localhost ([::1]:43075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtHeU-0005Zf-Ed for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Nov 2015 11:08:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtHeP-0005ZN-Vz for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 11:08:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtHeM-0006MB-JB for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 11:08:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtHeM-0006M7-Fh for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 11:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZtHeM-0007TM-4W for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2015 11:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Nov 2015 16:08: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.144648045128679 (code B ref 17453); Mon, 02 Nov 2015 16:08:02 +0000 Original-Received: (at 17453) by debbugs.gnu.org; 2 Nov 2015 16:07:31 +0000 Original-Received: from localhost ([127.0.0.1]:49875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZtHdr-0007SU-2U for submit@debbugs.gnu.org; Mon, 02 Nov 2015 11:07:31 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:31476) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZtHdp-0007SJ-5y for 17453@debbugs.gnu.org; Mon, 02 Nov 2015 11:07:29 -0500 Original-Received: (qmail 12296 invoked by uid 3782); 2 Nov 2015 16:07:28 -0000 Original-Received: from acm.muc.de (p5B147B71.dip0.t-ipconnect.de [91.20.123.113]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 02 Nov 2015 17:07:27 +0100 Original-Received: (qmail 14130 invoked by uid 1000); 2 Nov 2015 16:09:17 -0000 Content-Disposition: inline In-Reply-To: <831tc8xv39.fsf@gnu.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:108304 Archived-At: Hello, Eli. On Mon, Nov 02, 2015 at 05:46:34PM +0200, Eli Zaretskii wrote: > Lets' take emacs-devel out of this shall we? OK. > > Date: Mon, 2 Nov 2015 12:35:12 +0000 > > From: Alan Mackenzie > > Cc: Juri Linkov , 17453@debbugs.gnu.org, > > Stefan Monnier , > > emacs-devel > > > 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. > > What is causing the unwanted scrolling rather than moving to the next > > window, is the form "(sit-for 0)" near the start of > > isearch-lazy-highlight-new-loop. When point is outside the window, this > > form causes redisplay, which scrolls point back into the window - > > without Follow Mode getting a look in. In my patch, I replaced this > > with "(sit*-for 0)", where Follow Mode can do its thing before the > > redisplay happens. > If this means that sit*-for does something other than redisplay and > wait, like switch to another window, I'd really suggest to rethink > that. It is entirely counter-intuitive to have a sit-for family of > functions do anything other than some kind of redisplay and some kind > of waiting. sit*-for's synchronising windows, switching to the appropriate window, etc., is conceptually an extension of redisplay's scrolling to get point on screen. But I think sit*-for could well be not needed here, anyway. > I think it is a better idea to have Isearch switch to another window > when the next hit is there, via some specialized movement command that > Follow mode could customize. That'd be something expectable. No. The right fix is not to do "(sit-for 0)" at that point in the processing. As I explained at length to Artur in another post today, if we move lazy-highlight's checking whether window-start/end have changed, into the function triggered by the timer, redisplay will already have happened and so we won't need that offending sit-for. Then Follow Mode will quite naturally select the next window (via its post-command-hook), rather than isearch forcibly scrolling the first one. As currently happens when lazy highlighting is disabled. -- Alan Mackenzie (Nuremberg, Germany).