Subject: bug#32874: Unwanted scrolling in edebug `f' command when follow-mode is active

From: Alan Mackenzie <[email-masked]>
Date: Sat, 29 Sep 2018 15:37:29 +0000

Hello, Eli.

On Sat, Sep 29, 2018 at 17:35:43 +0300, Eli Zaretskii wrote:
> > Date: Sat, 29 Sep 2018 14:09:57 +0000
> > From: Alan Mackenzie <[email-masked]>

> > The immediate cause of this is at edebug--recursive-edit L+86, where
> > there is a call to (sit-for 0).  If this call is commented out, and the
> > bug scenario repeated, there is no spurious scrolling.  That call is
> > there for a reason, however, so this isn't a fix for the bug.

> What is the reason for calling sit-for?  Can the call to sit-for be
> replaced with something else when follow-mode is in effect and we
> aren't in the last window of the follow group?

sit-for is called right after (edebug-overlay-arrow), I think, to ensure
that the newly placed arrow is actually drawn on the screen.

I can't think of any replacement for this sit-for at the moment.

> > The use of post-command-hook for follow mode is clearly suboptimal.
> > Follow mode is essentially a part of redisplay, so it ought to get called
> > from a redisplay hook.  The trouble is, `redisplay-hook' doesn't exist.

> Actually, redisplay-hook is not well defined, because different
> potential customers of such a hook would like that hook to be called
> from different parts of the redisplay cycle and under different
> conditions.  Thus we have pre-redisplay-function instead, and a few
> other specialized hooks the display engine calls, like
> window-scroll-functions.

OK, that sounds like a good reason for not having such a hook.  :-(

> > The best available hooks which might serve seem to be
> > pre-redisplay-function or pre-redisplay-functions.  Unfortunately, these
> > are called too late, after redisplay has already determined which windows
> > to operate on.

> That's not true: pre-redisplay-function is called _before_ the display
> engine determines what window(s) might need to be redrawn.

Thanks!  I'll have a look at pre-redisplay-function, and see if I can do
anything with it.

-- 
Alan Mackenzie (Nuremberg, Germany).