I am using (setq scroll-preserve-screen-position t) as suggested at https://superuser.com/a/184421/39697, and it works well, except for me, when I scroll at the top of the screen using scroll-up-line, the cursor moves foward one character (same with the bottom of the screen).

This isn't happening with emacs -Q, so I'm unsure what in my configuration is causing it. I'd like to use bug-hunter to find why, but I'm unsure how to encode this as a test expression.

  • If a point is partially visible at the top or the bottom of the screen based on everything that is going on (e.g., font size, frame size, etc.), Emacs will (during redisplay) readjust to make it fully visible. That is done at the C level, not elisp. There are some additional settings that could make it more noticeable, and you might have added one of those -- e.g., scroll-margin. I don't know if this is related to your issue. – lawlist May 15 '15 at 23:48
  • Instead of just pointing us to your configuration, recursively bisect your init file to find the problem. It's very quick to do. You can use comment-region to comment out 1/2, then 3/4, 7/8,... of the file. Once you've located the problem, if you still need help then report about it here, in more detail. – Drew May 16 '15 at 2:37
  • Just to make sure, does this happen consistently? I mean: if you open any file that is longer than a single window, and you place point at the last line of the window, and you invoke M-x scroll-up-line, will it always move point forward by one character? – Malabarba May 16 '15 at 10:10
  • @Malabarba no it happens in the other direction. If I put it at the bottom line (and I am not at the top of the document) and I run M-x scroll-down-line then the cursor moves forward. For instance if the cursor is in column 3 after running scroll-down-line it will be in column 4 (and on the previous line obviously). Ditto for scroll-up-line if it is at the top of the windows: it moves one column forward each time. It also happens when using C-v and M-v. I haven't been able to play with it too much yet, but it does seem to do it every time so far. – asmeurer May 19 '15 at 19:03
  • And to clarify, when the cursor is anywhere else in the window, or when scrolling it into the window (scroll-up-line when it's at the bottom of visa versa) the behavior is as expected: the cursor stays on the column it was on. This is also true of C-v and M-v: they only move the cursor column when it is at the very top or bottom of the window. – asmeurer May 19 '15 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.