BackspaceKey

;; map backspace [delete-backward-char] to C-h
(define-key key-translation-map [?\C-?] [?\C-h])

;; map M-backspace [backward-kill-word] to M-h
(define-key key-translation-map [?\M-\d] [?\M-h])

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

;; map M-h [mark-paragraph] to M-backspace
(define-key key-translation-map [?\M-h] [?\M-\d])

;; tip: Tab is available as C-i
;;      RET is available as C-j or C-m
;;      ESC is available as C-[

That way C-h and M-h behave like the backwards version of C-d and M-d, and help is available with a single press of backspace key.

key-translation-map takes care of different functions of backspace key in different modes. For example, backspace key runs [Info-scroll-down] in Info mode and [delete-backward-char] in text mode.

The above is tested with Emacs 29, both in pure GTK mode and in alacritty terminal emulator. I’m using sway window manager with X disabled.

To use C-h as backward-delete-char in other GTK programs, use

 gsettings set org.gnome.desktop.interface gtk-key-theme "Emacs"

It is unclear how to achieve the same with QT programs.

terminal

When using emacs on a terminal the backspace may delete-forward (same as C-d), to have it delete-backwards issue command M-x normal-erase-is-backspace-mode. To load automatically modify your emacs start up file accordingly, for example:

    (if (not window-system) (normal-erase-is-backspace-mode 0))

CategoryKeys