Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/purcell/disable-mouse
Disable the mouse in Emacs
https://github.com/purcell/disable-mouse
Last synced: about 2 months ago
JSON representation
Disable the mouse in Emacs
- Host: GitHub
- URL: https://github.com/purcell/disable-mouse
- Owner: purcell
- Created: 2016-06-18T02:34:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-20T14:51:42.000Z (2 months ago)
- Last Synced: 2024-11-20T15:40:39.165Z (2 months ago)
- Language: Emacs Lisp
- Size: 278 KB
- Stars: 106
- Watchers: 5
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Melpa Status](http://melpa.org/packages/disable-mouse-badge.svg)](http://melpa.org/#/disable-mouse)
[![Melpa Stable Status](http://stable.melpa.org/packages/disable-mouse-badge.svg)](http://stable.melpa.org/#/disable-mouse)# Disable the mouse in Emacs
Want to force yourself to use the keyboard in Emacs, and you don't
have a cat available to obstruct your trackpad? Use this local or
global minor mode to suppress the default mouse behaviours, as an
alternative to using a cat (see picture below).You might also consider the [inhibit-mouse](https://github.com/jamescherti/inhibit-mouse.el)
package instead, which uses a more elaborate approach that better handles certain modes like `evil`,
and the built-in `tab-bar`.![Cat disabling trackpad by lying across it while the author tries to continue working](disable-mouse-cat.jpg)
## Installation
### Manual
Ensure `disable-mouse.el` is in a directory on your load-path, and
add the following to your `~/.emacs` or `~/.emacs.d/init.el`:```elisp
(require 'disable-mouse)
(global-disable-mouse-mode)
```If you use Evil, this may be insufficient, since the keymaps for
Evil's individual states will contain bindings for mouse
events. `disable-mouse` provides a function `disable-mouse-in-keymap`
which you can use to neutralise any keymap, so Evil users might use a
snippet like the following in addition to that above:```elisp
(mapc #'disable-mouse-in-keymap
(list evil-motion-state-map
evil-normal-state-map
evil-visual-state-map
evil-insert-state-map))
```Note that you won't be able to restore those Evil mouse bindings by turning off
`disable-mouse-mode`. You'll need to restart Emacs instead.(As noted above, Evil users are likely to prefer the
[inhibit-mouse](https://github.com/jamescherti/inhibit-mouse.el) package.)### MELPA
If you're an Emacs 24 user or you have a recent version of
`package.el` you can install `disable-mouse` from the
[MELPA](http://melpa.org) repository. The version of
`disable-mouse` there will always be up-to-date.Enable `global-disable-mouse-mode` with `M-x global-disable-mouse-mode`, by using
the customisation interface, or by adding code such as the following
to your emacs startup file:```elisp
(global-disable-mouse-mode)
```If you want to only disable the mouse in only a certain mode, add
`disable-mouse-mode` to that mode's hook.### Related packages
After writing this, I found
[handoff](https://github.com/rejeep/handoff.el), which has a similar
goal, but aims for more annoyance and frivolity.[inhibit-mouse](https://github.com/jamescherti/inhibit-mouse.el) provides only a global mode,
but it works by using `input-decode-map`, which gives better results overall, particularly for `evil` users.
These days you should probaby prefer that package to this one.## About
Author: Steve Purcell
Homepage: https://github.com/purcell/disable-mouse
This little library was extracted from the author's
[full Emacs configuration](https://github.com/purcell/emacs.d), which
readers might find of interest.
[💝 Support this project and my other Open Source work](https://www.patreon.com/sanityinc)
[💼 LinkedIn profile](https://uk.linkedin.com/in/stevepurcell)
[✍ sanityinc.com](http://www.sanityinc.com/)