diff --git a/config.el b/config.el index 6f21ae1..85e96dc 100644 --- a/config.el +++ b/config.el @@ -178,10 +178,25 @@ Bound to cmd+v in org-mode and markdown-mode." [down-mouse-1] [down-mouse-2] [down-mouse-3])) (global-set-key key #'ignore)) (setq mouse-highlight nil) - ;; Smooth scroll wheel: 3 lines per tick, no acceleration + + ;; Scroll wheel — macOS NS/Cocoa generates pixel-level scroll events from + ;; trackpad and Magic Mouse. pixel-scroll-precision-mode (Emacs 29+) handles + ;; these natively for smooth, 1:1 scrolling. Line-based mouse-wheel-scroll-amount + ;; is kept as fallback for physical scroll wheels that send line events. (setq mouse-wheel-scroll-amount '(3 ((shift) . 1) ((control) . nil)) mouse-wheel-progressive-speed nil - mouse-wheel-follow-mouse t)) + mouse-wheel-follow-mouse t) + + ;; Enable pixel-precise scrolling (Emacs 29+) — essential for macOS trackpad/ + ;; Magic Mouse. Translates pixel deltas from NS scroll events into smooth + ;; pixel-level buffer scrolling instead of jerky line jumps. + (when (fboundp 'pixel-scroll-precision-mode) + (pixel-scroll-precision-mode 1) + ;; Large scroll threshold: pixel deltas above this trigger line-based scroll + ;; (prevents trackpad fling from being interpolated frame-by-frame). + (setq pixel-scroll-precision-large-scroll-height 40.0 + ;; Use momentum scrolling from macOS (trackpad inertia) + pixel-scroll-precision-use-momentum t)))