From a1b01eb3d3e7cfe59bfd6b1e35d5485a97d39359 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Wed, 10 Jun 2015 14:47:54 +0100 Subject: [PATCH] dot/emacs, el/dot-emacs.el: Defeat `keyboard-escape-quit'. Organization: Straylight/Edgeware From: Mark Wooding This is a really bad command to invoke by accident because it vaporizes your current, possibly elaborate, window configuration. Unfortunately, it's bound to ESC ESC ESC, which is also C-[ C-[ C-[, and C-[ is right next to C-p, which I often try to bounce on, oblivious to the occasional off-by-one error. * Bind ESC ESC to a function which says `wrong-button' (and fails to ring the bell because Emacs is broken). At least this way I'm likely to notice. * Bind ESC C-] C-] to `keyboard-escape-quit', because it might just be useful for something. --- dot/emacs | 2 ++ el/dot-emacs.el | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/dot/emacs b/dot/emacs index f409792..6b15066 100644 --- a/dot/emacs +++ b/dot/emacs @@ -466,6 +466,8 @@ (setq windmove-wrap-around t) (trap (iswitchb-mode)) (progn + (global-set-key [?\e ?\e] 'mdw-wrong) + (global-set-key [?\e ?\C-\] ?\C-\]] 'keyboard-escape-quit) (global-set-key [?\C-x ?w left] 'windmove-left) (global-set-key [?\C-x ?w ?h] 'windmove-left) (global-set-key [?\C-x ?w up] 'windmove-up) diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 3a461d6..dbc1677 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -52,6 +52,11 @@ (defmacro mdw-regexps (&rest list) (debug 0)) `',(make-regexp list)) +(defun mdw-wrong () + "This is not the key sequence you're looking for." + (interactive) + (error "wrong button")) + ;; Some error trapping. ;; ;; If individual bits of this file go tits-up, we don't particularly want -- [mdw]