0
  • I currently satisfice by disabling auto-hscroll-mode, but I want it back.
  • I know you can make it hscroll only the current line by setting it to 'current-line. Doesn't fix the problem.

Problem: it's surprisingly hard to get back to the default unscrolled view unless you memorize a hotkey for scroll-right. Besides, pointwise motion should be sufficient (because it is in most modes), but in certain major modes like Eshell it cannot be relied on because beginning-of-line won't get you to the beginning of the line.

Result: you appear to be stuck in a hscrolled state, resulting in SX questions like 64393.

I think user-friendly behavior would be that when (current-column) drops below (window-width), i.e. the line can fit within the window, we evaluate (scroll-right most-positive-fixnum), undoing the hscroll entirely.

I tried to advise line-move-finish, but it's not always the cause of line motion. How to always react to line motion?

Test case:

  1. emacs -Q
  2. M-x eshell
  3. M-x set-variable RET truncate-lines RET t RET
  4. Type a very long line so auto-hscroll-mode is invoked.
  5. Try to get back a sane view...
2
  • I tried steps 1 to 3, and noticed that eshell defaults to truncate-lines being nil, which means that auto-hscroll-mode has no effect. Are there any other settings that are missing from the test case that we should be using? And, (setq auto-hscroll-mode 'current-line) should naturally be set before step 3. Ideally, the test case should be from Emacs -Q (no user configuration). Please also specify what numeric version of Emacs you are using, and whether you are in the terminal or the GUI version.
    – lawlist
    Sep 6, 2021 at 13:20
  • Thank you for pointing out the truncate-lines thing. It should work in emacs -Q now.
    – meedstrom
    Sep 9, 2021 at 16:55

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.