Closed neeasade closed 5 years ago
There are a few things I do want with this -- I'm using shx in combination with shell-pop[1] for convienent shells and bindings. The two issues I have right now:
That last is more of an issue with shell-pop integration for me to figure out, just noting my limitations right now
[1] https://github.com/kyagi/shell-pop-el
config for reference: https://github.com/neeasade/emacs.d/blob/master/lisp/trees/shell.el#L39
I hacked around with this idea today -- what do you think of the behavior of something like this:
(defun shx-cmd-ssh (host)
"Open a shell on HOST using tramp.
\nThis way you benefit from the remote host's completions, and
commands like :pwd and :edit will work correctly.
\nExample:\n
:ssh username@hostname:port"
(if (equal host "")
(shx-insert 'error "ssh <host>\n")
(shx-insert "Connecting to " 'font-lock-doc-face host 'default "\n")
(let ((host (replace-regexp-in-string ":" "#" host)))
(setq-local default-directory (if (eq tramp-syntax 'default)
(concat "/ssh:" host ":~")
(concat "/" host ":~")))
(kill-process)
(shell (buffer-name shx-buffer)))))
We also have to add a check to line 219 along the lines of (when (process-live-p process) (comint-send-string process "\n")))))
since we're swapping the process midstream.
That works very well, thank you
Awesome - I'll merge this PR in as a basis for the change this weekend. I think there are a few more tweaks that would help (handling a disconnect for instance) that I'll put in the next shx release.
fixes https://github.com/riscy/shx-for-emacs/issues/11