Sarah
Sarah

Reputation: 6696

Disable mouse clicks in Emacs

Is there any way I can disable all mouse click events in Emacs? I tend to get focus issues when I accidentally hit my touch pad on my laptop and suddenly I'm in another Emacs window.

Upvotes: 18

Views: 5494

Answers (3)

sanityinc
sanityinc

Reputation: 15242

I've created a package called disable-mouse, which provides local and global minor modes for disabling all mouse interaction in the current buffer or all buffers respectively.

Upvotes: 5

Victor Deryagin
Victor Deryagin

Reputation: 12225

Try this:

(dolist (k '([mouse-1] [down-mouse-1] [drag-mouse-1] [double-mouse-1] [triple-mouse-1]  
             [mouse-2] [down-mouse-2] [drag-mouse-2] [double-mouse-2] [triple-mouse-2]
             [mouse-3] [down-mouse-3] [drag-mouse-3] [double-mouse-3] [triple-mouse-3]
             [mouse-4] [down-mouse-4] [drag-mouse-4] [double-mouse-4] [triple-mouse-4]
             [mouse-5] [down-mouse-5] [drag-mouse-5] [double-mouse-5] [triple-mouse-5]))
  (global-unset-key k))

Upvotes: 18

klang
klang

Reputation: 524

Try making a M-x describe-key, and press the touch pad. Emacs will then tell you what the key is currently bound to. Unbind it and you should be ok. The touch pad should still work on the emacs frame, though.

Upvotes: 2

Related Questions