I like having mouse-wheel-follow-mouse set to non-nil, so I can use the trackpad to scroll an inactive window. Unfortunately, it doesn't apply to horizontal scrolling, so if I try to scroll an inactive window side-to-side, the active window scrolls (horizontally) instead. Is there a way to fix that?

Here's what I have in my init.el as far as scrolling configuration:

(setq scroll-step 1
      scroll-margin 0
      hscroll-step 1
      hscroll-margin 2
      scroll-conservatively 200
      mouse-wheel-scroll-amount '(0.01 ((shift) . 1)))

(defun ivan/scroll-right ()
  (scroll-right 2))
(defun ivan/scroll-left ()
  (scroll-left 2))

(defvar ivan/hscroll-minor-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map [wheel-right] #'ivan/scroll-left)
    (define-key map [wheel-left] #'ivan/scroll-right)

(define-minor-mode ivan/hscroll-minor-mode :init-value t)
(ivan/hscroll-minor-mode 1)

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.