Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The best way to set a key to do nothing

My touchpad occasionally issues [mouse-12] events which results in annoying flickering and a repeating <mouse-12> is undefined message.

According to elisp conventions, what is the best way to do nothing?

(global-set-key [mouse-12] 'WHAT-TO-INSERT-HERE?)
like image 707
Daniel Vartanov Avatar asked Sep 06 '25 16:09

Daniel Vartanov


1 Answers

That would be the ignore function:

ignore is an interactive compiled Lisp function in ‘subr.el’.

It is bound to <mouse-movement>, <bottom-divider> <mouse-1>,
<right-divider> <mouse-1>.

(ignore &rest IGNORE)

Do nothing and return nil.
This function accepts any number of arguments, but ignores them.

If it's good enough for the mouse-movement event, it should be good enough for the touchpad:

(global-set-key [mouse-12] 'ignore)
like image 177
legoscia Avatar answered Sep 10 '25 15:09

legoscia