I want to unset the backspace key and I tried this:

(global-unset-key (kbd "<backspace>"))

Evaluating this in the buffer gives me nil but still the backspace key works as expected. How to unbind this?

After unbinding when I do C-h k on backspace it still shows me this:

DEL (translated from <backspace>) runs the command autopair-backspace, which is an interactive compiled Lisp function in `autopair.el'.

It is bound to DEL.


Possibly delete a pair of paired delimiters.

  • Do you still want to keep using autopair?
    – abo-abo
    Commented Dec 29, 2014 at 21:29
  • @abo-abo Yes, but if there is a way to rebind backspace key to some other key in autopair and all the other modes that has some binding for backspace key, then that would be very nice.
    – Sibi
    Commented Dec 29, 2014 at 21:31
  • This is how I'll do, (local-unset-key (kbd "<DEL>")) or (global-unset-key (kbd "<DEL>")). Curiously, it works only in another buffer, not in *scratch* buffer :\
    – Nsukami _
    Commented Dec 29, 2014 at 21:48

3 Answers 3


Finally figured this out, this will re-map Backspace key to C-h everywhere:

(define-key key-translation-map [?\C-h] [?\C-?])

Source: Magnar Sveen's Emacs configuration


Try this:

(define-key (cdar autopair--emulation-alist) (kbd "DEL") nil)

This looks very non-standard, by the way.


Alright, here's a weird fix:

(setcdr (car autopair--emulation-alist)
        '(keymap (93 . autopair-skip-close-maybe)
          (91 . autopair-insert-opening)
          (41 . autopair-skip-close-maybe)
          (40 . autopair-insert-opening)
          (34 . autopair-insert-or-skip-quote)
          (13 . autopair-newline))) 
  • Sorry, doesn't work.
    – Sibi
    Commented Dec 29, 2014 at 21:40
  • Try to eval this in *scratch*. autopair--emulation-alist is buffer-local.
    – abo-abo
    Commented Dec 29, 2014 at 21:41
  • Tried it in *scratch*, but doesn't seem to have any effect.
    – Sibi
    Commented Dec 29, 2014 at 21:43

This is not exactly an answer to your question since it doesn't unset the DEL binding, but the following piece of code should shadow any existing binding (whether defined by autopair or any other minor/major mode or the global map):

(defun do-nothing ()
  "Don't do anything"

(define-minor-mode no-backspace-mode
  "Disable the backspace key"
  :global t
  :lighter " noBackspace")

(defvar no-backspace--emulation-alist
     . ,(let ((map (make-sparse-keymap)))
          (define-key map (kbd "DEL") #'do-nothing)

(add-to-list 'emulation-mode-map-alists 'no-backspace--emulation-alist)

When no-backspace-mode is active, the DEL key should not do anything. It should work as usual when no-backspace-mode is inactive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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