5
  • scroll-margin is 1 but Emacs still sometimes allows the cursor to stay at the 1st line of a window.

Follow these steps to reproduce it (or see the GIF below):

  1. emacs -Q

  2. In buffer *scratch*, C-x C-e:

    (progn
      (custom-set-variables
       '(custom-enabled-themes '(modus-vivendi))
       '(global-tab-line-mode t)
       '(scroll-margin 1)
       '(scroll-conservatively 101))
      (info-emacs-manual)
      (end-of-buffer)
      (goto-line 500))
    
  3. With the cursor now at the 2nd line from the top of the window, press <up>-arrow-key several times and pay attention to resulting cursor position.

enter image description here


This behavior is inconsistent with the documentation (and has caused me great trouble in practice):

C-h v scroll-margin:

Its value is 1
Original value was 0

Number of lines of margin at the top and bottom of a window.

The correct behavior is what next-line does;
You can try the <down>-arrow-key after step 3 described above:

enter image description here


Q:

Why doesn't the setting of scroll-margin work here?
IOW, what causes previous-line to move the cursor beyond the margin (which is inconsistent with next-line's behavior when Emacs automatically scrolls up)?


Information that may be helpful in troubleshooting:

  • If either '(custom-enabled-themes '(modus-vivendi)) or '(global-tab-line-mode t) is removed, the bug will disappear.

emacs-version: 28.2
system-configuration: x86_64-w64-mingw32

emacs-version: 30.0.50
system-configuration: x86_64-pc-linux-gnu


Question is Solved

I reported this as bug#63201 and it should be fixed now on the emacs-29 branch.

7
  • Please separate (remove) everything that should be a bug report (M-x report-emacs-bug), and make clear what your question is. Is this the question: "If you remove either '(custom-enabled-themes '(modus-vivendi)) or '(global-tab-line-mode t), the bug will disappear. I don't know why."? IOW, is your question "Why?"? Or is this it? "how to get previous-line to do that stably?"
    – Drew
    Commented Apr 3, 2023 at 21:35
  • 1
    @Drew: The question has been edited.
    – shynur
    Commented Apr 4, 2023 at 4:06
  • 1
    I am able to reproduce the issue on Emacs 29.0.60 . The problem occurs only in at the top section of the scrolled text. Scrolling to the bottom and then up works as expected a very long time until the given upper section of text is reached where the point jumps to the first line. Quite weird this behavior. Especially because scrolling down keeps in my test a 2 lines margin and scrolling up a 1 line margin. Without the theme there is no weird behavior. With the theme but no global-tab-line-mode scrolling down keeps two lines margin. Scrolling up is OK.
    – oOosys
    Commented Apr 4, 2023 at 19:35
  • See it this way: it seems not to be a bug in Emacs ... Emacs works as expected and OK. It seems to be a problem with the modus-vivendi theme. So the question is: is it a bug in the theme or a feature of the theme? Have you reported a bug? Just post the link to the bug report ( find the link to the bug page searching for the bug number here: debbugs.gnu.org ).
    – oOosys
    Commented Apr 4, 2023 at 20:15
  • @Claudio: “It seems to be a problem with the modus-vivendi theme.” --- No. See “if you remove either '(custom-enabled-themes '(modus-vivendi)) or '(global-tab-line-mode t), the bug will disappear.” And in fact that my example is only one of the cases that scroll-margin doesn't work. I posted only one example here because it has already taken me much time to narrow such one example down.
    – shynur
    Commented Apr 4, 2023 at 21:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.