[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17453: Framework extending window functions for Follow Mode (etc.).
From: |
Alan Mackenzie |
Subject: |
bug#17453: Framework extending window functions for Follow Mode (etc.). |
Date: |
Tue, 10 Nov 2015 11:08:24 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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 <PageUp> and <PageDown> 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).
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Juri Linkov, 2015/11/08
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Alan Mackenzie, 2015/11/09
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Juri Linkov, 2015/11/09
- bug#17453: Framework extending window functions for Follow Mode (etc.).,
Alan Mackenzie <=
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Juri Linkov, 2015/11/10
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Alan Mackenzie, 2015/11/11
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Juri Linkov, 2015/11/11
- bug#17453: Framework extending window functions for Follow Mode (etc.)., martin rudalics, 2015/11/12
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Juri Linkov, 2015/11/12
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Alan Mackenzie, 2015/11/17
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Juri Linkov, 2015/11/17
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Alan Mackenzie, 2015/11/18
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Alan Mackenzie, 2015/11/18
- bug#17453: Framework extending window functions for Follow Mode (etc.)., Juri Linkov, 2015/11/18