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: Framework extending window functions for Follow Mode (etc.). Date: Tue, 10 Nov 2015 11:08:24 +0000 Message-ID: <20151110110823.GB2626@acm.fritz.box> References: <20151105192905.GA7986@acm.fritz.box> <20151107182420.GA1774@acm.fritz.box> <871tc18oai.fsf@mail.linkov.net> <20151108002955.GC1774@acm.fritz.box> <8737wgou4z.fsf@mail.linkov.net> <20151109154124.GC2284@acm.fritz.box> <87611a8x96.fsf@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1447153650 20218 80.91.229.3 (10 Nov 2015 11:07:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Nov 2015 11:07:30 +0000 (UTC) Cc: 17453@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 10 12:07:18 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 1Zw6lc-0001KB-7S for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 Nov 2015 12:07:12 +0100 Original-Received: from localhost ([::1]:58930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw6lb-0000fj-Ew for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 Nov 2015 06:07:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw6lV-0000cH-PI for bug-gnu-emacs@gnu.org; Tue, 10 Nov 2015 06:07:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zw6lS-00052g-Ga for bug-gnu-emacs@gnu.org; Tue, 10 Nov 2015 06:07:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw6lS-00052b-DA for bug-gnu-emacs@gnu.org; Tue, 10 Nov 2015 06:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zw6lR-0000DB-U5 for bug-gnu-emacs@gnu.org; Tue, 10 Nov 2015 06:07: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: Tue, 10 Nov 2015 11:07:01 +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.1447153610796 (code B ref 17453); Tue, 10 Nov 2015 11:07:01 +0000 Original-Received: (at 17453) by debbugs.gnu.org; 10 Nov 2015 11:06:50 +0000 Original-Received: from localhost ([127.0.0.1]:59761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zw6lF-0000Cl-Px for submit@debbugs.gnu.org; Tue, 10 Nov 2015 06:06:50 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:49970) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zw6kv-0000CL-0e for 17453@debbugs.gnu.org; Tue, 10 Nov 2015 06:06:48 -0500 Original-Received: (qmail 6679 invoked by uid 3782); 10 Nov 2015 11:06:27 -0000 Original-Received: from acm.muc.de (p579E9232.dip0.t-ipconnect.de [87.158.146.50]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 10 Nov 2015 12:06:27 +0100 Original-Received: (qmail 3043 invoked by uid 1000); 10 Nov 2015 11:08:24 -0000 Content-Disposition: inline In-Reply-To: <87611a8x96.fsf@mail.linkov.net> 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:108612 Archived-At: Hello, Juri. On Tue, Nov 10, 2015 at 02:51:41AM +0200, Juri Linkov wrote: > >> I tried to not use isearch-string-out-of-window/isearch-back-into-window > >> at all, but I can't get a useful behavior in such situation of scrolling > >> out of the window with the current search hit. Could you show how you see > >> it should work in this case in follow-mode? > > To start with, set > > (global-set-key [next] 'follow-scroll-up) > > (global-set-key [prior] 'follow-scroll-down) > > (setq isearch-allow-scroll t) > > . Then start an Isearch not too close to the start of a buffer with > > Follow Mode enabled with at least two windows. Type something to get a > > search match highlighted. Now and should scroll that > > match between Follow Mode windows, the boundaries of that scrolling being > > the top of the LH window and the bottom of the RH window. > > To make this work properly, the four variables in > > isearch-string-out-of-window, w-start, w-end, w-L1, w-L-1, are set to the > > positions in the entire group of windows, by setting the proposed > > &optional argument GROUP to t in the calls to certain window functions, > > e.g. > > (let ((w-start (window-start nil t)) > > ^ > Could you provide the shortest patch to test the behavior that you describe? Can I ask you here to look at the initial patch in the archive for bug #17453 (see below)? > For now I tried the following, is this what you want to generalise with > a new framework? More or less, yes. > diff --git a/lisp/isearch.el b/lisp/isearch.el > index b762884..3b61505 100644 > --- a/lisp/isearch.el > +++ b/lisp/isearch.el > @@ -2237,10 +2237,19 @@ (defun isearch-string-out-of-window (isearch-point) > 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 (window-start (and (fboundp 'follow-all-followers) > + (car (follow-all-followers))))) > + (w-end (window-end (and (fboundp 'follow-all-followers) > + (car (last (follow-all-followers)))) > + t)) > + (w-L1 (save-excursion > + (when (fboundp 'follow-all-followers) > + (select-window (car (follow-all-followers)))) > + (move-to-window-line 1) (point))) > + (w-L-1 (save-excursion > + (when (fboundp 'follow-all-followers) > + (select-window (car (last (follow-all-followers))))) > + (move-to-window-line -1) (point))) > start end) ; start and end of search string in buffer > (if isearch-forward > (setq end isearch-point start (or isearch-other-end isearch-point)) As a small point, I think you'd want a `save-selected-window' around the forms which bind w-L1 and w-L-1. [ .... ] > > The last alternative is a quick and dirty fix where Isearch would just > > call Follow Mode functions. I don't think anybody really wants this. > > Would it help if I actually made the source available? If so, where? I > > don't really think it would be appropriate to dump a patch of this size > > on emacs-devel, and the time to commit the changes to master has clearly > > not yet arrived. > You are trying to do everything at once. To successfully achieve your goals > it would be much more clear for us to see the progress step by step, i.e. > if at first you demonstrated how to fix the co-operation between Isearch and > Follow Mode by a quick and dirty fix like in the patch above then we could see > how well your fixes work, and also what places need generalisation, > and how your new framework would be useful here and for other packages > that might benefit from it. I posted the quick and dirty fix on 2014-05-09 in the opening post for bug #17453 (the bug which is still current and has around 55 posts). This post is, naturally, still available on http://debbugs.gnu.org. I was encouraged by Stefan instead to formulate the change as a more general framework, removing the direct access to follow-mode.el from isearch.el. I first posted a description of the framework on 2015-10-29, in the bug #17453 thread. This was criticised by Eli, and I amended it substantially in response. > By such inductive method we could quickly arrive to a conclusion > without much friction. I posted the essence of the framework, as it now is, in a (cut down) patch at the beginning of this thread. I have complete patches for both the framework and isearch.el available. Together, they are really too big to post on emacs-devel. -- Alan Mackenzie (Nuremberg, Germany).