Subject: Re: bug#23546: 25.1.50; scroll-restore-mode breaks comint-mode

From: martin rudalics <[email-masked]>
Date: Thu, 19 May 2016 14:56:38 +0200

> Hmm...  Probably I completely missed the point, but is not
 > ‘scroll-restore-jump-back’ an option that enables the title
 > functionality of scroll-restore-mode — restoring the point position
 > after scrolling, thus simulating the behaviour of most editors, which
 > does not have that limitation of Emacs — that cursor position can be
 > on-screen only.

The aim of ‘scroll-restore-mode’ was much more modest: To move the
cursor to the position of ‘window-point’ after a sequence of scroll
commands have made that position invisible and then visible again.

‘scroll-restore-jump-back’ is much more aggressive: It forces the
position of ‘window-point’ to become visible again and move the cursor
to it after the first command which is not part of a sequence of scroll
commands that have made that position invisible.  If you are used to the
behavior of "most editors" where such behavior is the default, you might
like this.

Note, however, that the behavior I just described is not precisely the
behavior of these editors because, in addition to moving window-point
when it is scrolled off-screen, Emacs may also move window-point when it
enters the scroll margin.  Such movement is left alone by my algorithm.

 > How would you recommend to use it?  To write an advice around ‘keyboard-quit’ (like below), so scrolling would be ‘cancelled’ only with ‘C-g’?
 >
 > (defadvice keyboard-quit (before scroll-restore-jump-back activate)
 >    (scroll-restore-jump-back))
 >

It depends on what precisely you want to accomplish (or what you are
used to).  But why on earth would you want to advise ‘keyboard-quit’?

 >> I'll attach my latest version of ‘scroll-restore-mode’.  Please try it.
 >> If you confirm that this version works
 >
 > Yes.  My appreciations to you.
 >
 >> and doesn't break anything else,
 >
 > I could not try anything, of course, but at first sight it does not.

All you have to do is use it for a sufficient amount of time.  I'm
confident that there are unresolved issues left.

martin