]> gitweb.michael.orlitzky.com - emacs.d.git/commitdiff
mode-hooks: unbind some keys for multi-term mode.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 24 Jun 2020 16:43:28 +0000 (12:43 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 24 Jun 2020 16:45:15 +0000 (12:45 -0400)
This for example allows you to exit an emacs-within-an-emacs running
in multi-term mode with C-x C-c C-c. Useful for git commits, or
becoming Lewis Carroll.

mode-hooks.el
mode-hooks/multi-term-hooks.el [new file with mode: 0644]

index d2ca0196a0e778bad7e723b9a78936b92ae7eabc..30599e2f9fb0e7312eee0233d7e2a72989debf9f 100644 (file)
@@ -5,6 +5,7 @@
 (load-library "css-mode-hooks")
 (load-library "js-mode-hooks")
 (load-library "haskell-mode-hooks")
+(load-library "multi-term-hooks")
 (load-library "nxml-mode-hooks")
 (load-library "octave-mode-hooks")
 (load-library "python-mode-hooks")
diff --git a/mode-hooks/multi-term-hooks.el b/mode-hooks/multi-term-hooks.el
new file mode 100644 (file)
index 0000000..9b4f963
--- /dev/null
@@ -0,0 +1,11 @@
+(defun mtm-hook()
+  ;; Pass through C-c, C-x, and M-x for emaception.
+  (delete "C-x" term-unbind-key-list)
+  (delete "C-c"   term-unbind-key-list)
+  (delete "<ESC>" term-unbind-key-list)
+
+  ;; We don't need the special C-c C-c any afterwards.
+  (delete '("C-c C-c" . term-interrupt-subjob) term-bind-key-alist)
+)
+
+(add-hook 'term-mode-hook (function mtm-hook))