branch: elpa/crux commit 430235753cda1e9af75d209e36a2c9c4f6599a80 Author: Justin Burkett <jus...@burkett.cc> Commit: Bozhidar Batsov <bozhidar.bat...@gmail.com>
Make crux-visit-term-buffer ask to restart dead process (#36) --- crux.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crux.el b/crux.el index 579816d..9fe00f2 100644 --- a/crux.el +++ b/crux.el @@ -120,11 +120,16 @@ the current buffer." (switch-to-buffer-other-window buffer-name))) (defun crux-visit-term-buffer () - "Create or visit a terminal buffer." + "Create or visit a terminal buffer. +If the process in that buffer died, ask to restart." (interactive) (crux-start-or-switch-to (lambda () (ansi-term crux-shell (concat crux-term-buffer-name "-term"))) - (format "*%s-term*" crux-term-buffer-name))) + (format "*%s-term*" crux-term-buffer-name)) + (when (and (null (get-buffer-process (current-buffer))) + (y-or-n-p "The process has died. Do you want to restart it? ")) + (kill-buffer-and-window) + (crux-visit-term-buffer))) (defun crux-indent-rigidly-and-copy-to-clipboard (begin end arg) "Indent region between BEGIN and END by ARG columns and copy to clipboard."