]> gitweb.michael.orlitzky.com - emacs.d.git/blob - mode-hooks/multi-term-hooks.el
mode-hooks: hack around double-emacs-nw in multi-term mode.
[emacs.d.git] / mode-hooks / multi-term-hooks.el
1 (defun mtm-hook()
2 ;; In a multi-term, we strip out any "-nw" or "--no-window-system"
3 ;; flags that are present in the EDITOR and VISUAL environment
4 ;; variables, to avoid getting trapped inside a double-emacs-nw.
5 (setq editor (getenv "EDITOR"))
6 (setq editor (replace-regexp-in-string " -nw" "" editor))
7 (setq editor (replace-regexp-in-string " --no-window-system" "" editor))
8 (setenv "EDITOR" editor)
9
10 (setq visual (getenv "VISUAL"))
11 (setq visual (replace-regexp-in-string " -nw" "" visual))
12 (setq visual (replace-regexp-in-string " --no-window-system" "" visual))
13 (setenv "VISUAL" visual)
14 )
15
16 (add-hook 'term-mode-hook (function mtm-hook))