From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: bug#17453: Isearch doesn't work properly with Follow Mode. Date: Sun, 01 Nov 2015 22:54:21 +0200 Message-ID: <838u6hxwxu.fsf@gnu.org> References: <20140509224458.GA4205@acm.acm> <20151029232302.GB3812@acm.fritz.box> <20151031233225.GD1853@acm.fritz.box> <20151101135253.GB2768@acm.fritz.box> <83k2q1y893.fsf@gnu.org> <20151101182733.GE2768@acm.fritz.box> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1446411279 29133 80.91.229.3 (1 Nov 2015 20:54:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Nov 2015 20:54:39 +0000 (UTC) Cc: bruce.connor.am@gmail.com, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 01 21:54:30 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 1Zsze1-00072b-BF for ged-emacs-devel@m.gmane.org; Sun, 01 Nov 2015 21:54:29 +0100 Original-Received: from localhost ([::1]:38833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zsze0-000820-KL for ged-emacs-devel@m.gmane.org; Sun, 01 Nov 2015 15:54:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zszdx-00081q-Jk for emacs-devel@gnu.org; Sun, 01 Nov 2015 15:54:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zszdt-000874-7J for emacs-devel@gnu.org; Sun, 01 Nov 2015 15:54:25 -0500 Original-Received: from mtaout28.012.net.il ([80.179.55.184]:54411) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zszds-00086y-QF for emacs-devel@gnu.org; Sun, 01 Nov 2015 15:54:21 -0500 Original-Received: from conversion-daemon.mtaout28.012.net.il by mtaout28.012.net.il (HyperSendmail v2007.08) id <0NX500000LY9E000@mtaout28.012.net.il> for emacs-devel@gnu.org; Sun, 01 Nov 2015 22:53:05 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout28.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NX500HOOM0H2270@mtaout28.012.net.il>; Sun, 01 Nov 2015 22:53:05 +0200 (IST) In-reply-to: <20151101182733.GE2768@acm.fritz.box> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.184 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:193083 Archived-At: > Date: Sun, 1 Nov 2015 18:27:33 +0000 > Cc: bruce.connor.am@gmail.com, emacs-devel@gnu.org > From: Alan Mackenzie > > > How is this "not having isearch know about Follow mode"? I see that > > knowledge on every step of this patch, whenever you call the new > > functions. > > It has no knowledge of the internals of Follow Mode. But the window*-* functions do. And any code that calls them _knows_ about Follow mode. Maybe it's just me, but I see no real difference in having the Follow mode explicitly called out in a separate function, instead in isearch.el itself. > The new patch doesn't insert things like this into isearch.el: > > + (if (and (boundp 'follow-mode) follow-mode) > + (progn (follow-adjust-window (selected-window)) > + t) It inserts them indirectly via calling special functions. Which means a package cannot really be oblivious to Follow mode's existence. > > I thought you will come up with some more generic framework for > > commands to "scroll" the display by switching to the next window (when > > under Follow mode), if possible. But unless I'm missing something > > very important, this isn't that framework, is it? > > Follow Mode itself choses which window to leave point in. For example, > if isearch started in the left hand window, FM will place point in the > RH window if the first match is there. That's not what I see. What I see is that starting Isearch in the left window scrolls that window, and then the right window scrolls accordingly. What I'd expect (if I were a user of Follow mode) us an automatic switch to the right window, and scroll only when that window is also exhausted. That doesn't happen, at least not with the current master. In any case, what I thought you'd do is introduce a bunch of variables, such as window-selection-for-scroll-function, that will allow Follow mode to override the default (trivial) value and dictate its own decisions to its clients. Or something like that. > window*-start and friends do constitute a generic framework. No, a generic framework would be, for example, to have a variable whose value is a function, and let Follow mode override the default value. > > Btw, I see no reason to introduce new functions. Instead, we could > > have the original ones accept an additional optional argument. > > We could. But that might make these functions less "pure": as well as > doing what they do, they would also have to execute some call-out to > Follow Mode in some fashion. Isn't that what window*-* functions do anyway? Where's the benefit? > > You are right about not relying on the list, but window-next-sibling > > and window-prev-sibling are available, and always will be, so you can > > "trivially" use them instead of relying on a list. > > The next/previous sibling might be displaying a different buffer. But that's very easy to test, no? > to use window-next/previous-sibling properly would mean some fairly > extensive changes to the innards of Follow Mode - FM has its own > left-to-right, top-to-bottom algorithm for ordering its windows. What algorithm could that be, if not something that traverses the window tree in some order? > > If you agree, then John's question still stands, I think. > > The "car of a list of windows" he was talking about means that list of > windows needs to come from somewhere. The list is maintained by Follow > Mode, really only available using an internal FM function. As soon as > we use this, we have coupled isearch with Follow Mode more tightly. > This is undesirable. Not if you go through a variable whose default value Follow mode can override. Or some other decoupling technique like that, I'm sure there are more, perhaps more elegant ones.