An option that might or might not be useful is scroll-preserve-screen-position
. The description is somewhat hard to understand, but a net result is that if you mainly scroll using C-v/M-v
, the point will visually stay at the same place on the screen (so if you do e.g. C-v C-v M-v M-v
, the point will come back to its original position.
However, note that many commands do push a mark before they jump: isearch
, end-of-buffer
, imenu
, xref-find-definition
... In all those cases, you can then press C-u C-SPC
(the same command that you use to set the mark but called with a prefix argument) to pop the mark (concretely, jump to the last mark). If you need to jump back more than once, you can set the variable set-mark-command-repeat-pop
to t
, so that you only need to do C-u
once and then repeatedly press C-SPC
to pop more and more marks from the mark ring.
In general, there are better ways to navigate a buffer than scrolling in the wild; the cases where you do need to scroll, starting from "your current" point are (or should/could be ...) sufficiently rare that you know beforehand that you will be spending a possibly long time "looking around" in the buffer. It is then quite fast to set a mark, do your stuff somewhere else, and C-u <mash C-SPC as often as needed>
until you get back to your initial point.