Subject: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor

From: Eli Zaretskii <[email-masked]>
Date: Thu, 16 Oct 2014 18:00:20 +0300

> Date: Thu, 16 Oct 2014 08:58:25 -0600
> From: Josh <[email-masked]>
> Cc: [email-masked]
> 
> Let me restate the problem: I am looking for a way to maintain cursor
> position within a buffer, even when other events cause that position
> to be moved beyond the edges of the window.
> 
> There are so many ways that this can happen that it is not possible to
> advise every function that might do it.  It is possible that
> window-scroll-functions will give me everything I need, but I haven't
> had time to try it yet.  We can resume this conversation at such a
> time, unless there is someone else who already knows that
> window-scroll-functions will not work.

Sorry, I thought you only wanted this with a few specific commands.
AFAIR, you never mentioned anything but the mouse-wheel scroll.