From 9bf41c045a77a3c06f571ecae91c815d7e0d4ecb Mon Sep 17 00:00:00 2001 From: Daneel Date: Mon, 23 Feb 2026 14:32:47 +0100 Subject: [PATCH] Revert "fix(scroll): enable pixel-scroll-precision-mode for smooth macOS trackpad scrolling" This reverts commit 372e93fce43047d6bb212d3cf1f12dd8cd7e3ea6. --- config.el | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/config.el b/config.el index efcaf53..1afdeb1 100644 --- a/config.el +++ b/config.el @@ -180,23 +180,22 @@ Bound to cmd+v in org-mode and markdown-mode." (global-set-key key #'ignore)) (setq mouse-highlight nil)) -;; macOS smooth scrolling — pixel-scroll-precision-mode (Emacs 29+, works on NS/Cocoa) -;; pixel-scroll-precision-mode handles [wheel-up/down] → pixel-scroll-precision. -;; ns-use-mwheel-momentum: macOS sends momentum-phase events after finger lift; -;; setting t passes them through so kinetic/inertial scrolling works. -;; pixel-scroll-precision-use-momentum nil: let macOS handle momentum (Emacs -;; momentum simulation would double-apply on top of NS momentum events). +;; macOS scroll wheel best practice (NS/Cocoa build): +;; - pixel-scroll-precision-mode is NOT used: it targets X11/Haiku and breaks +;; NS/Cocoa scroll event delivery (rebinds [wheel-up/down] to non-working handlers) +;; - Standard mwheel.el with conservative settings is reliable on macOS +;; - NS backend converts trackpad + physical wheel to [wheel-up]/[wheel-down] events (when (display-graphic-p) - ;; NS/macOS: honour trackpad kinetic (inertial) scrolling - (setq ns-use-mwheel-momentum t) - ;; Horizontal scroll + follow-mouse still go through mwheel.el - (setq mouse-wheel-follow-mouse t - mouse-wheel-tilt-scroll t) - ;; Pixel-precise vertical scrolling (Emacs 29+) - (when (fboundp 'pixel-scroll-precision-mode) - (setq pixel-scroll-precision-use-momentum nil ; macOS provides its own momentum - pixel-scroll-precision-large-scroll-height 40.0) - (pixel-scroll-precision-mode 1))) + (require 'mwheel) + ;; 3 lines per scroll tick; shift = 1 line; no progressive acceleration + (setq mouse-wheel-scroll-amount '(3 ((shift) . 1) ((meta) . 0) ((control) . text-scale)) + mouse-wheel-progressive-speed nil ; constant speed, no acceleration + mouse-wheel-follow-mouse t ; scroll window under cursor + mouse-wheel-tilt-scroll t ; horizontal scroll with tilt/two-finger + mouse-wheel-flip-direction nil) ; standard direction (not natural) + ;; Ensure mwheel-scroll is bound (Doom may remap these) + (global-set-key [wheel-up] #'mwheel-scroll) + (global-set-key [wheel-down] #'mwheel-scroll))