Home

Awesome

inhibit-mouse.el - Deactivate mouse input in Emacs

MELPA Build Status License

The inhibit-mouse package allows the disabling of mouse input in Emacs using inhibit-mouse-mode.

Instead of modifying the keymap of its own mode as the disable-mouse package does, enabling inhibit-mouse-mode only modifies input-decode-map to disable mouse events, making it more efficient and faster than disable-mouse.

Additionally, the inhibit-mouse package allows for the restoration of mouse input when inhibit-mouse-mode is disabled.

This concept of utilizing input-decode-map to disable the mouse was introduced by Stefan Monnier in an emacs-devel mailing list thread initiated by Daniel Radetsky, who proposed a patch to the Emacs developers.

Installation

To install outline-indent from MELPA:

  1. If you haven't already done so, add MELPA repository to your Emacs configuration.
  2. Add the following code to the Emacs init file:
(use-package inhibit-mouse
  :ensure t
  :config
  (inhibit-mouse-mode))

Frequently Asked Question

What is the difference between the disable-mouse and inhibit-mouse packages?

The inhibit-mouse package is a simpler and faster alternative to the disable-mouse package, as it only modifies input-decode-map to disable mouse events.

In contrast, disable-mouse applies mouse events to its own mode, and sometimes the user has to apply it to other modes that are not affected by the disable-mouse mode using the disable-mouse-in-keymap function (e.g, evil-mode, tab-bar...).

Additionally, inhibit-mouse allows re-enabling mouse functionality when the mode is disabled, which is not supported by disable-mouse when the disable-mouse-in-keymap function is used. The disable-mouse-in-keymap function overwrites the key mappings of other modes (e.g., evil, tab-bar), and there is no straightforward way to make disable-mouse restore them.

Is there an alternative package that utilizes input-decode-map?

Daniel Radetsky, the person who sent an email to emacs-devel about disabling the mouse, developed a similar package that deactivates the mouse using input-decode-map. Coincidentally, we had the same idea at about the same time after reading Stefan Monnier's email.

What motivates the author to disable the mouse in Emacs?

The author disables the mouse in Emacs:

Some may suggest that the author could modify the touchpad settings at the OS level. However, he prefers not to disable the touchpad entirely, as it remains useful in other applications, such as web browsers.

Author and License

The inhibit-mouse Emacs package has been written by James Cherti and is distributed under terms of the GNU General Public License version 3, or, at your choice, any later version.

Copyright (C) 2024 James Cherti

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.

Links

Other Emacs packages by the same author: