dot/emacs, el/dot-emacs.el: Defeat `keyboard-escape-quit'.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 10 Jun 2015 13:47:54 +0000 (14:47 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 10 Jun 2015 13:51:37 +0000 (14:51 +0100)
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
el/dot-emacs.el

index f409792..6b15066 100644 (file)
--- a/dot/emacs
+++ b/dot/emacs
 (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)
index 3a461d6..dbc1677 100644 (file)
@@ -52,6 +52,11 @@ This may be at the expense of cool features.")
           (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