8

I already use scroll-conservatively to smooth the vertical scrolling behaviour of Emacs. The horizontal scrolling is still pretty bad. The screen jumps by many columns, and I often lose track of where I am.

Is it possible to make this more smoothly?

2
  • Horizontal scrolling? You are not using visual-line-mode?
    – choroba
    Commented Aug 15, 2013 at 8:31
  • 1
    Oh no, I dislike that mode. :)
    – Arne
    Commented Aug 15, 2013 at 11:16

2 Answers 2

4

There appears no direct equivalent of scroll-conservatively for horizontal scrolling, but customizing hscroll-step (and perhaps also hscroll-margin) should produce something at least close to the same behavior. From the manual:

The variable hscroll-margin controls how close point can get to the window's left and right edges before automatic scrolling occurs. It is measured in columns. For example, if the value is 5, then moving point within 5 columns of an edge causes horizontal scrolling away from that edge.

The variable hscroll-step determines how many columns to scroll the window when point gets too close to the edge. Zero, the default value, means to center point horizontally within the window. A positive integer value specifies the number of columns to scroll by. A floating-point number specifies the fraction of the window's width to scroll by.

2
  • Works perfectly.
    – Arne
    Commented Aug 21, 2013 at 14:25
  • @Arne Excellent! Glad to hear it. Commented Aug 21, 2013 at 14:28
6

This is off-topic to scrolling with my trackpad, but who knows:

(global-set-key (kbd "<mouse-7>") '(lambda ()
                                     (interactive)
                                     (scroll-left 4)))
(global-set-key (kbd "<mouse-6>") '(lambda ()
                                     (interactive)
                                     (scroll-right 4)))

If you want to discover what Emacs thinks your horizontal scroll "button" is, try C-h k (describe-key) and then use your horizontal scroll. So in my current setup, Emacs reports <mouse-7> and <mouse-6>. I started with (scroll-left 1), but replaced with 4 to get faster scrolling.

1
  • Excellent, I couldn't get hscroll-step to take effect, but this works well - thank you.
    – davidA
    Commented Dec 4, 2019 at 1:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .