Subject: bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions

From: Philipp Stephani <[email-masked]>
Date: Wed, 14 Sep 2016 19:48:23 +0000

Eli Zaretskii <[email-masked]> schrieb am Mi., 14. Sep. 2016 um 21:24 Uhr:

> > From: Philipp Stephani <[email-masked]>
> > Date: Wed, 14 Sep 2016 18:43:13 +0000
> > Cc: [email-masked], [email-masked]
> >
> >  Since the problem that caused the patch to be reverted was with
> >  narrowing, why not simply use
> >
> >  (= point (with-current-buffer (window-buffer window) (point-min)))
> >
> >  instead of
> >
> >  (= point 1)
> >
> >  ?
> >
> > This has the same issues as described above. There's more code in
> cursor-sensor--detect that assumes (eq
> > (current-buffer) (window-buffer window)), e.g. the form
> (get-char-property point 'cursor-sensor-functions).
> > Therefore (= point (with-current-buffer (window-buffer window)
> (point-min))) must be the same as (bobp).
> > Another mystery is the stack trace entry
> "run-hook-with-args(cursor-sensor--detect #<window 224 on
> > *Group*>)". How can cursor-sensor--detect be the first argument to
> run-hook-with-args? Shouldn't it always
> > be pre-redisplay-functions?
>
> If we want to dig deeper, I think we should first understand why bop
> doesn't work.  Is it indeed because the window's buffer is not the
> current buffer when the hook is called?
>

Unfortunately the error doesn't trigger consistently. Maybe we are lucky
and somebody manages to detect such an issue.

I'd also suggest to add
(cl-assert (eq (current-buffer) (window-buffer window)))
to cursor-sensor--detect, because the function relies on this equality.