2

I disabled mouse scrolling with (mouse-wheel-mode -1), but when I drag mouse or click mouse, there will warnings like "triple-mouse-4 is undefined", "mouse-3 is undefined" etc.

Is there anyway to disable these prompt as it's very annoying.

FYI, I'm using Emacs 24.3 with X11 in OS X Mavericks

goofansu
  • 2,277
  • 3
  • 30
  • 48

1 Answers1

4

Define them as 'ignore.

(dolist (k mwheel-installed-bindings)
  (global-set-key k 'ignore))

If you want to disable only mouse scrolling, the following code is better than (mouse-wheel-mode -1)

(substitute-key-definition 'mwheel-scroll 'ignore global-map)

If you want to disable mouse key bindings, see the code at Disable mouse clicks in Emacs (but (global-set-key k 'ignore) instead of (global-unset-key k))

The following advice also solves the problem. It disables all messages shown by undefined. Here I use the macro noflet provided by the package noflet. Please install noflet by package-install. Since noflet is very powerful, I think the solution above is more safe.

(require 'noflet)
(defadvice undefined (around no-message activate)
  (noflet ((message (msg &rest args)))
    ad-do-it))
Community
  • 1
  • 1
sho
  • 56
  • 3
  • With `(mouse-wheel-mode -1)`, the mouse key bindings have been already unset. – goofansu Sep 07 '14 at 12:35
  • `mouse-wheel-mode` uses `global-unset-key`. If a key is unset by `global-unset-key`, then pressing the key shows a message in the echo area. But binding the key to `ignore`, then no messages are shown when pressing the key. – sho Sep 07 '14 at 14:04