当与其关联的进程结束时,如何自动终止终端缓冲区。
答案 0 :(得分:4)
我找到了更简单的方法,在term-handle-exit
(defadvice term-handle-exit
(after term-kill-buffer-on-exit activate)
(kill-buffer))
答案 1 :(得分:1)
我发现我可以使用进程标记并使用term-exec-hook
(add-hook 'term-exec-hook (lambda ()
(let* ((buff (current-buffer))
(proc (get-buffer-process buff)))
(lexical-let ((buff buff))
(set-process-sentinel proc (lambda (process event)
(if (string= event "finished\n")
(kill-buffer buff))))))))