public
Description: my emacs configuration.
Clone URL: git://github.com/crazycode/emacs.d.git
add hook for shell mode, to kill the shell buffer when type exit.
crazycode (author)
Sat Aug 23 10:05:16 -0700 2008
commit  2181e9331dc8556a6a2ee692fee4af8db207362a
tree    6463c2cd66fd83f115ffbc2b51460e785bface0b
parent  d4ef93dc16a36ad2f277ec1ded3ae36167463838
...
114
115
116
 
 
 
 
 
 
 
 
 
 
 
 
 
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
0
@@ -114,3 +114,16 @@
0
 (global-set-key (quote [M-up]) (quote move-region-up))
0
 (global-set-key (quote [M-down]) (quote move-region-down))
0
 (global-set-key "\C-c\C-c2" 'circle-windows)
0
+
0
+(add-hook 'shell-mode-hook 'my-shell-mode-hook-func)
0
+(defun my-shell-mode-hook-func ()
0
+ (set-process-sentinel (get-buffer-process (current-buffer))
0
+ #'my-shell-mode-kill-buffer-on-exit)
0
+ )
0
+(defun my-shell-mode-kill-buffer-on-exit (process state)
0
+ (message "%s" state)
0
+ (if (or
0
+ (string-match "exited abnormally with code.*" state)
0
+ (string-match "finished" state))
0
+ (kill-buffer (current-buffer))))
0
+(global-set-key "\C-x\M-r" 'term)

Comments

    No one has commented yet.