It probably happened to every (X11) Emacs user already. We routinely use backspace to kill a character, C-backspace to kill a word, C-x backspace to kill a sentence, etc. And inevitably, we press C-M-backspace trying to kill an s-expression, just to find ourselves wondering why the screen suddenly turns black for a moment before the login screen appears again. Yup, we zapped the X server, because that is what C-M-backspace does.
Yesterday, it was Riastradh's turn to press the wrong key combination. An easy solution to prevent high blood pressure and lost work next time is to put the following snippet into the X configuration file (e.g., /etc/X11/xorg.conf):
Section "ServerFlags" # When this option is enabled, C-M-backspace # has no special meaning and is passed to clients. Option "DontZap" "True" EndSection
However, this requires root priviledges, which we might not have on every machine. There is another solution, which does not require any special rights. A short look with xmodmap shows what the Backspace key is wired to:
% xmodmap -pke|grep -i backspace keycode 22 = BackSpace Terminate_Server
We may get rid of it with:
% xmodmap -e 'keysym BackSpace = BackSpace BackSpace'
Reenabling the zap behavior is possible as well:
% xmodmap -e 'keysym BackSpace = BackSpace Terminate_Server'
Well, it would be too easy if this would all work now, wouldn't it? Unfortunately, newer versions of X, in particular X.org version X11R7 (Debian xserver-xorg 1:7.0.22), seem to kill the server regardless whether or not Terminate_Server is assigned to a key, unless mentioned DontZap option is added to the global configuration file. Back to Square One.
Please, won't somebody think about the