Skip to content

Commit

Permalink
respawn dead shell at remote location (re: #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
riscy committed Jan 26, 2020
1 parent 1433836 commit ef6b7ea
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions shx.el
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ In normal circumstances this input is additionally filtered by
`shx-filter-input' via `comint-mode'."
(interactive)
(cond ((not (comint-check-proc shx-buffer))
;; no process? restart shell in a safe directory:
(when (file-remote-p default-directory)
(setq default-directory (getenv "HOME")))
(shx--restart-shell))
((>= (length (shx--current-input)) shx-max-input)
(message "Input line exceeds `shx-max-input'."))
Expand Down Expand Up @@ -402,6 +399,7 @@ If any path is absolute, prepend `comint-file-name-prefix' to it."

(defun shx--restart-shell ()
"Guess the shell command and use `comint-exec' to restart."
(message (concat "Starting shell at " default-directory " (C-g cancels)"))
(let ((cmd (shx--validate-shell-file-name)))
(shx-insert 'font-lock-doc-face cmd " at " default-directory "\n")
;; manually align comint-file-name-prefix with the default-directory:
Expand Down

0 comments on commit ef6b7ea

Please sign in to comment.