[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 51f0ccc: Put follow-mode's engine on pre-redisp
Re: [Emacs-diffs] master 51f0ccc: Put follow-mode's engine on pre-redisplay-hook instead of post-command-hook
Wed, 3 Oct 2018 13:14:11 +0000
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
> > +(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
> > +;; 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.
Alan Mackenzie (Nuremberg, Germany).