5

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.

11

You can bind it to the function ignore:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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