From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 51f0ccc: Put follow-mode's engine on pre-redisplay-hook instead of post-command-hook
Date: Wed, 3 Oct 2018 13:14:11 +0000 [thread overview]
Message-ID: <20181003131411.GB16238@ACM> (raw)
In-Reply-To: <jwvbm8bw7qn.fsf-monnier+emacsdiffs@gnu.org>
Hello, Stefan.
On Wed, Oct 03, 2018 at 08:20:30 -0400, Stefan Monnier wrote:
> Hi Alan,
> > Put follow-mode's engine on pre-redisplay-hook instead of
> > post-command-hook
> Yay!
> > +(defun follow-pre-redisplay-function (wins)
> > + (if (or (eq wins t)
> > + (null wins)
> > + (and (listp wins)
> > + (memq (selected-window) wins)))
> > + (follow-post-command-hook)))
> I'm not sure it's possible for (selected-window) not to be memq of wins,
> but even if it is, it's likely to be extremely rare. So the above (or ...)
> is probably just a complicated way to say `t`.
Maybe. But it looks safe, and keeps rigidly to the contract of
pre-redisplay-function.
> > +;; The magic little box. This function was formerly called after every
> > +;; command. It is now called before each redisplay operation (see
> > +;; `follow-pre-redisplay-function' above), and at the end of several
> > +;; search/replace commands. It retains its historical name.
> I wonder why this is still needed.
There are interfaces like `isearch-update-post-hook' that need a
function with no arguments. Isearch calls this hook at the end of a
search operation, and this allows follow-mode to resynchronise the
windows before a redisplay.
I tried removing this interface, hoping that the pre-redisplay-function
would do everything properly anyway, but it didn't - a search caused the
LH window to scroll rather than moving point to the RH window. Also the
windows have to be aligned before lazy highlighting takes place. So
`isearch-update-post-hook' and friends stay.
Also, for debugging follow-adjust-window, it is helpful to put
follow-pre-redisplay-function temporarily on post-command-hook, allowing
edebug to work.
Let me save you the bother of telling me I could just make the wins
argument &optional. ;-) I've just noticed that.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2018-10-03 13:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181003105358.19923.64797@vcs0.savannah.gnu.org>
[not found] ` <20181003105359.AA7EC204E8@vcs0.savannah.gnu.org>
2018-10-03 12:20 ` [Emacs-diffs] master 51f0ccc: Put follow-mode's engine on pre-redisplay-hook instead of post-command-hook Stefan Monnier
2018-10-03 13:14 ` Alan Mackenzie [this message]
2018-10-03 13:52 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181003131411.GB16238@ACM \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.