Unfortunately, that's not what OP wants. What OP wants is that when they scroll, the position of the cursor remains at the same position in the buffer (the contents), even when that means that it leaves the currently visible screen.
What scroll-preserve-screen-position determines, is whether the point/cursor stays at the same visual position in the screen — i.e. if for instance your cursor was in the middle of the screen, it will stay in the middle when you scroll.
OP needs the currently non-existent scroll-preserve-buffer-position.
The lack of "scroll-preserve-buffer-position" has been a very minor pet peeve for me for multiple years, and for some reason this very simple solution just never occurred to me.
I can't believe I didn't think of this. I'm already using marks to keep track of position when I scroll, it's just all manual right now.
I'll likely mess around with some hooks in my config this weekend and see if this is actually feasible, or if it comes with caveats I'm not seeing right now. I guess it would need to account for multiple windows open into the same buffer too.
I'm convinced the edge cases will dominate this code, but the general idea seems straight forward. If you get this working, please share. Not something I think I want, per se, but I could be mistaken on seeing it work. :)
"Instead of setting the mark in order to operate on a region, you can also use it to remember a position in the buffer (by typing C-<SPC> C-<SPC>), and later jump back there (by typing C-u C-<SPC>)." -- https://www.gnu.org/software/emacs/manual/html_node/emacs/Se...
Sure, but then every time the user does anything that might scroll the point off the screen, he has to remember to C-<SPC> C-<SPC> first. Installing a new habit that has to activate before such a wide range of editing operations can take a lot of time, during which the user is less productive because part of his attention is devoted to installing the new habit.
You're right. In practice I usually C-/ (undo) C-g / (redo) to get back to where I was; which is something you can do after you've lost your place in the file, but it assumes to previously made some change in that location.
(setq scroll-preserve-screen-position 1)