From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: bug#17453: Isearch doesn't work properly with Follow Mode. Date: Sun, 1 Nov 2015 18:27:33 +0000 Message-ID: <20151101182733.GE2768@acm.fritz.box> References: <20140509224458.GA4205@acm.acm> <20151029232302.GB3812@acm.fritz.box> <20151031233225.GD1853@acm.fritz.box> <20151101135253.GB2768@acm.fritz.box> <83k2q1y893.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 1446402376 27678 80.91.229.3 (1 Nov 2015 18:26:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Nov 2015 18:26:16 +0000 (UTC) Cc: bruce.connor.am@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 01 19:26:08 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 1ZsxKR-0002a0-IX for ged-emacs-devel@m.gmane.org; Sun, 01 Nov 2015 19:26:07 +0100 Original-Received: from localhost ([::1]:38414 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsxKQ-0006vM-SR for ged-emacs-devel@m.gmane.org; Sun, 01 Nov 2015 13:26:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsxKD-0006v5-6u for emacs-devel@gnu.org; Sun, 01 Nov 2015 13:25:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsxK9-00017o-7Q for emacs-devel@gnu.org; Sun, 01 Nov 2015 13:25:53 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:14996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsxK8-00017b-Qn for emacs-devel@gnu.org; Sun, 01 Nov 2015 13:25:49 -0500 Original-Received: (qmail 78267 invoked by uid 3782); 1 Nov 2015 18:25:45 -0000 Original-Received: from acm.muc.de (p548A4E61.dip0.t-ipconnect.de [84.138.78.97]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 01 Nov 2015 19:25:44 +0100 Original-Received: (qmail 4240 invoked by uid 1000); 1 Nov 2015 18:27:33 -0000 Content-Disposition: inline In-Reply-To: <83k2q1y893.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-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:193073 Archived-At: Hello, Eli. On Sun, Nov 01, 2015 at 06:50:00PM +0200, Eli Zaretskii wrote: > > Date: Sun, 1 Nov 2015 13:52:53 +0000 > > From: Alan Mackenzie > > Cc: emacs-devel > > > > No problem! The patch below doesn't actually apply at the moment, due > > to some (?very) recent change in isearch.el. But it wouldn't run > > anyway, because window*-start and friends aren't there yet. > > > > > > > > diff --git a/lisp/isearch.el b/lisp/isearch.el > > index 4fc9b38..07ec534 100644 > > --- a/lisp/isearch.el > > +++ b/lisp/isearch.el > 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. window*-start is merely an abstract interface, currently with two implementations associated with it, a default one for normal windows and a Follow Mode one. More implementations could be added, the Follow Mode one could be taken away. I'm not sure I really understand your question. At several points in isearch, functions need to be called which eventually end up calling Follow Mode functions. > So maybe I'm missing something, but I really don't see why this > variant is significantly better than the one Stefan didn't like. Can > you explain what am I missing here? 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) , though the old one from eighteen months ago did. The new patch doesn't use any FM internal interfaces, indeed doesn't do anything directly with FM, beyond temporarily disabling it when a "small window" comes into effect because of a "slow terminal". > 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. window*-start and friends do constitute a generic framework. Any Elisp library can replace window-start by window*-start, etc., and it then operates on the entire group of FM windows rather than just one window. > 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. The Follow Mode hook would then tell window-start which window it _really_ should return the start of. Maybe this would be better, maybe it would be more messy. > As yet another comment, wrt this exchange between you and John: > > > What is the reason for having separate functions such as window*-start, > > > instead of just taking the car of a list of windows? I may be missing some > > > context here, but this sounds like special-casing general behavior, and I'm > > > wondering why it's necessary... > > [...] > > The fact that the "group" of windows is represented by a list is an > > implementation detail to be encapsulated within follow.el. In the > > (fairly distant) future, this might perhaps be superseded by code in > > redisplay. Perhaps. > 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. This happens quite frequently when you look up a tag with M-.. But 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. (I'm not defending this, by the way - it's just the way things are at the moment.) > 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. -- Alan Mackenzie (Nuremberg, Germany).