From d6860c0fe52fe4cdb111fdbdf8426b135deb9bfa Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 16 Jan 2022 03:36:45 +0000 Subject: [PATCH] fix(macos): disable ctrl+scroll emacs keybindings on macOS Trackpad momentum can often lead to emacs trying to resize font size by thousands of points. Hence let's disable it, as font size changes are easy enough via C-x C-- and C-x C-=. --- core/siren-core-macos.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/siren-core-macos.el b/core/siren-core-macos.el index 20eeed6..1dbd702 100644 --- a/core/siren-core-macos.el +++ b/core/siren-core-macos.el @@ -44,5 +44,20 @@ ;; Set initial frame to fullscreen when Emacs starts. (add-to-list 'initial-frame-alist '(fullscreen . maximized)) +;; Override default ctrl+scroll text size keybindings on macOS to not have any +;; effect. +(defun siren-mouse-wheel-text-scale (_event) + "Custom version of `mouse-wheel-text-scale' which does NOTHING. + +macOS scroll momentum often leads to excessive text size changes +when using ctrl-based keybindings right after scrolling up/down. +This is very annoying, and in extreme cases locks up Emacs for +minutes as it's trying to reach 100,000 font size or something +crazy." + (interactive (list last-input-event))) + +(global-set-key (kbd "C-") 'siren-mouse-wheel-text-scale) +(global-set-key (kbd "C-") 'siren-mouse-wheel-text-scale) + (provide 'siren-core-macos) ;;; siren-core-macos.el ends here