Vladimir Sedach

Have Emacs - Will Hack

April 5, 2018

Reclaim C-M-<backspace> for backward-kill-sexp in X11

Topic: Emacs

The Xenocara base X Keyboard Extension rules file forces the terminate(ctrl_alt_bksp) symbol to be added to all keyboard models. This kills the X11 server when you press C-M-<backspace>. I have never found this shortcut to be useful (it is always a better idea to switch to another virtual console and try to see what locked up the graphics). backward-kill-sexp is on the other hand a very useful Emacs command that fits perfectly under C-M-<backspace>. You can remove terminate(ctrl_alt_bksp) and free up the keyboard shortcut by doing something similar to:

diff -c /usr/X11R6/share/X11/xkb/rules/base\~ /usr/X11R6/share/X11/xkb/rules/base
*** /usr/X11R6/share/X11/xkb/rules/base~	Tue Jul 26 12:30:06 2016
--- /usr/X11R6/share/X11/xkb/rules/base	Sat Apr  8 00:51:52 2017
***************
*** 973,985 ****
    tm2030USB-106 =       +inet(media_nav_acpi_common)
    trust_slimline =      +inet(media_nav_acpi_common)
    vsonku306     =       +inet(microsoftprooem)
!   $inetkbds     =       +inet(%m)+terminate(ctrl_alt_bksp)
    $maclaptop    =       +inet(apple)+level3(enter_switch)
    $applealu     =       +inet(apple)
    $macs	        =       +inet(apple)
    sun_type7_jp_usb	=	+sun_vndr/solaris(defaults_type7jp)
    $sun			=		+sun_vndr/solaris(defaults)
-   *             =       +terminate(ctrl_alt_bksp)

  ! model		layout		=	symbols
   $inetmediakbds	jp	=	+jp(henkan)
--- 973,984 ----
    tm2030USB-106 =       +inet(media_nav_acpi_common)
    trust_slimline =      +inet(media_nav_acpi_common)
    vsonku306     =       +inet(microsoftprooem)
!   $inetkbds     =       +inet(%m)
    $maclaptop    =       +inet(apple)+level3(enter_switch)
    $applealu     =       +inet(apple)
    $macs	        =       +inet(apple)
    sun_type7_jp_usb	=	+sun_vndr/solaris(defaults_type7jp)
    $sun			=		+sun_vndr/solaris(defaults)

  ! model		layout		=	symbols
   $inetmediakbds	jp	=	+jp(henkan)

Diff finished.  Sat Apr  8 00:57:37 2017

Now you can add this to your .emacs:

(global-set-key (kbd "C-M-<backspace>") 'backward-kill-sexp)