Subject: Horizontal Scrolling (Current Line): Wrong line gets h-scrolled.

From: Keith David Bershatsky <[email-masked]>
Date: Thu, 05 Jul 2018 08:30:05 -0700

With a few long lines (of different lengths) in a scratch buffer in Emacs master branch (freshly built), it is possible to visually observe that the wrong line gets horizontally scrolled instead of the current line.

Step 1:  Build a new Emacs from the master branch.

Step 2:  In a scratch buffer, paste the following long lines:

Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.
Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis.
Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis.
Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis.
Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.

Step 3:  Evaluate the following:

(progn
  (fundamental-mode)
  (setq-local auto-hscroll-mode 'current-line)
  (scroll-left 10 t))

Step 4:  Place the cursor at the very end of the buffer; i.e., at the very end of the last long line of text.  Make sure that it gets horizontally scrolled.

Step 5:  Press the arrow key up one (1) time.

Step 6:  Press M-Left one (1) time.  The cursor should now be on the second to the last line in the buffer, at the beginning of the word "lobortis."

Step 7:  Now press the arrow keys up or down and watch as the wrong line gets horizontally scrolled.  The line that was last visited before moving up/down is the line that gets horizontally scrolled instead of the current line.