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 00:08:41 +0300

> Date: Wed, 15 Oct 2014 14:01:34 -0700
> From: Josh <[email-masked]>
> Cc: [email-masked]
> 
> > If you jump back, you will actually undo the scroll, so I'm not sure
> > what kind of situation are you talking about, or why do you use the
> > scrolling commands to begin with.  Please elaborate.
> 
> I am writing code and I realize that I forgot the name of the variable
> that I defined 30 lines ago, I use the mouse to do a quick scroll up,
> read the name, and scroll back down where I came from.  The problem is
> that now the cursor location has changed, and I have to spend time
> trying to figure out which line I was typing on and moving my cursor
> back to that position.  It would be nice if I could have the cursor
> stay where I left it for the brief period that I peek elsewhere in the
> buffer.

The usual technique in Emacs is to put the mark where you were before
scrolling.  Then "C-x C-x" will get you back.