[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Philipp Stephani
Subject: bug#21730: 25.0.50; Random errors in redisplay--pre-redisplay-functions
Date: Wed, 14 Sep 2016 18:43:13 +0000

Eli Zaretskii <address@hidden> schrieb am Mi., 14. Sep. 2016 um 19:11 Uhr:

> Given that replacing (bobp) with (= point 1) does solve this bug, the documentation of pre-redisplay-functions
> must be incorrect, i.e. the current buffer is not the buffer of the window passed as argument. I think the only
> way how this can happen is that a previous entry in pre-redisplay-functions has changed the current buffer.
> Probably the implementation of redisplay--pre-redisplay-functions should be changed from
> (with-current-buffer (window-buffer win)
> (run-hook-with-args 'pre-redisplay-functions win))
> to
> (run-hook-wrapped 'pre-redisplay-functions
> (lambda (func) (with-current-buffer (window-buffer win)
> (funcall func win)
> nil))
> or so.
> So we might try the following: Replace redisplay--pre-redisplay-functions (and indeed, all hooks that
> document anything about the current buffer) as above. Then add (cl-assert (eq (current-buffer)
> (window-buffer window)) to cursor-sensor--detect and remove code such as (window-point window), because
> that must be equal to (point). WDYT? Or am I misunderstanding something?

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?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]