I've written a function that recenters the point each time it makes a long jump and I added it to the hook
window-scroll-functions. The length of the jump is determined by comparing the return value of
(line-number-at-pos (window-end)) to that of
(line-number-at-pos (window-end nil 'update)), where the former holds the line number at the
window-end position before the jump, and the latter after the jump.
The problem is that
window-scroll-functions runs also when I change the buffer displayed by the current window. In that case
(line-number-at-pos (window-end)) returns the line number at the
window-end position of the previous buffer, and I can't figure out which one it was because (ref.):
At the time of the call, the display-start position of the argument window is already set to its new value, and the buffer to be displayed in the window is set as the current buffer.
window-end of the previous buffer and the new one differ enough, my recentering function gets called even though it shouldn't.
How can I find out whether it was a buffer change that triggered