As laptop touchpads seem to be steadily increasing in size, one unfortunate
consequence is that it becomes increasingly harder to avoid touching them by
accident while you type. Most systems have safeguards in place that disable the
touchpad as you’re typing, but they always seem to fall short for me when it
comes to Emacs. While in Emacs, my hands are permanently resting on the keyboard
(and over the touchpad), so even if I stop typing for several seconds I don’t
want the touchpad to reactivate.
There are ways to permanently deactivate the touchpad with a hotkey, but, so
far, the solution that best fits my use-style is to disable it only inside
Emacs.
All we do here is define a minor-mode that binds all mouse-related keys to
ignore. This is a slight improvement over the code on this StackOverflow
answer. Of course, let’s not forget to enable this.
Two relevant limitations:
This doesn’t distinguish between a touchpad an an actual mouse.
It is still possible for modes to define specific buttons that interact with
the mouse, but that’s not a huge problem because these buttons take a small
portion of the screen so it’s fairly difficult to touch them by accident.
Update 29 Jun 2016
By mere coincidence, it looks like Steve Purcell implemented something extremely
similar (comment below). Unlike me, he actually had the decency of wrapping the
minor-mode in a Melpa package, and I know some might prefer that over
lengthening their init file.
Disable Mouse only inside Emacs
02 May 2016, by Artur Malabarba.As laptop touchpads seem to be steadily increasing in size, one unfortunate consequence is that it becomes increasingly harder to avoid touching them by accident while you type. Most systems have safeguards in place that disable the touchpad as you’re typing, but they always seem to fall short for me when it comes to Emacs. While in Emacs, my hands are permanently resting on the keyboard (and over the touchpad), so even if I stop typing for several seconds I don’t want the touchpad to reactivate.
There are ways to permanently deactivate the touchpad with a hotkey, but, so far, the solution that best fits my use-style is to disable it only inside Emacs.
All we do here is define a minor-mode that binds all mouse-related keys to
ignore
. This is a slight improvement over the code on this StackOverflow answer. Of course, let’s not forget to enable this.Two relevant limitations:
Update 29 Jun 2016
By mere coincidence, it looks like Steve Purcell implemented something extremely similar (comment below). Unlike me, he actually had the decency of wrapping the minor-mode in a Melpa package, and I know some might prefer that over lengthening their init file.
Tags: keybind, init.el, emacs,
validate.el: Schema validation for Emacs-Lisp »
« ANSI-colors in the compilation buffer output
Related Posts
A few paredit keys that take over the world in keybind
Fill and unfill paragraphs with a single key in keybind
An improvement to Emacs auto-correct in keybind
Content © 2019, All rights reserved. Icons under CC3.0.