unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: bruce.connor.am@gmail.com, emacs-devel@gnu.org
Subject: Re: bug#17453: Isearch doesn't work properly with Follow Mode.
Date: Sun, 1 Nov 2015 18:27:33 +0000	[thread overview]
Message-ID: <20151101182733.GE2768@acm.fritz.box> (raw)
In-Reply-To: <83k2q1y893.fsf@gnu.org>

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 <acm@muc.de>
> > Cc: emacs-devel <emacs-devel@gnu.org>
> > 
> > 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).



  reply	other threads:[~2015-11-01 18:27 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140509224458.GA4205@acm.acm>
     [not found] ` <jwva9aqbcl9.fsf-monnier+emacsbugs@gnu.org>
2015-10-29 23:23   ` bug#17453: Isearch doesn't work properly with Follow Mode Alan Mackenzie
2015-10-31 22:35     ` John Wiegley
2015-10-31 23:25       ` Alan Mackenzie
2015-10-31 23:41         ` John Wiegley
2015-11-01 11:59           ` Alan Mackenzie
2015-11-01  0:17       ` Drew Adams
2015-10-31 23:13     ` Artur Malabarba
2015-10-31 23:32       ` Alan Mackenzie
2015-11-01 12:20         ` Artur Malabarba
2015-11-01 12:23           ` Artur Malabarba
2015-11-01 13:52             ` Alan Mackenzie
2015-11-01 16:50               ` Eli Zaretskii
2015-11-01 18:27                 ` Alan Mackenzie [this message]
2015-11-01 19:46                   ` Artur Malabarba
2015-11-01 20:15                     ` Alan Mackenzie
2015-11-01 21:37                       ` Artur Malabarba
2015-11-01 20:42                     ` Artur Malabarba
2015-11-01 20:54                   ` Eli Zaretskii
2015-11-01 22:19                     ` Alan Mackenzie
2015-10-31 23:35     ` Juri Linkov
2015-10-31 23:56       ` Alan Mackenzie
2015-11-02  0:14         ` Juri Linkov
2015-11-02  3:35           ` Eli Zaretskii
2015-11-02  9:28           ` Alan Mackenzie
2015-11-02 11:53             ` Artur Malabarba
2015-11-02 12:14               ` Artur Malabarba
2015-11-02 12:39                 ` Alan Mackenzie
2015-11-02 12:35               ` Alan Mackenzie
2015-11-02 13:10                 ` Artur Malabarba
2015-11-02 14:18                   ` Artur Malabarba
2015-11-02 15:44                     ` Alan Mackenzie
2015-11-02 23:22                       ` Juri Linkov
2015-11-03 12:31                         ` Alan Mackenzie
2015-11-02 23:28                     ` Juri Linkov
2015-11-02 23:33             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151101182733.GE2768@acm.fritz.box \
    --to=acm@muc.de \
    --cc=bruce.connor.am@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).