4

There is a key on my keyboard which I do not want to do anything. By default when I press it I get a message in my mini-buffer reading <cancel> is not defined. I want to silence that message.

I successfully achieved that with:

(define-key global-map (kbd "<cancel>") (lambda () (interactive)))

But wanted to know if there is a more semantic way of achieving this.

1 Answer 1

10

You can bind it to the function ignore:

(global-set-key (kbd "<cancel>") #'ignore)
1
  • Which is essentially what the OP was doing, just a little more concise.
    – MAP
    Commented Jan 1, 2017 at 1:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.