branch: externals/ssh-deploy commit a7246531ab3d3c2d7cb3bd515353dfecbe5902c1 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Added support for launching remote eshell --- README.md | 3 +++ ssh-deploy.el | 28 ++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5245ceb..5995f2c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ The `ssh-deploy` plug-in for Emacs makes it possible to effortlessly deploy loca * Manual downloads and uploads of directories and files * Automatic and manual detection of remote changes of files * Launch remote terminals with the integrated `tramp-term` functionality (if it's installed) (SSH) +* Launch remote `eshell` terminals (SSH, FTP) * Launch remote browsing using `dired-mode` * Launch difference sessions using `ediff-mode` * Supports asynchronous operations if `async.el` is installed. (You need to setup an automatic authorization for this, like `~/.netrc` or key-based authorization) @@ -96,6 +97,7 @@ Set your user and group as owner and file permissions to `700`. Emacs should now (global-set-key (kbd "C-c C-z d") (lambda() (interactive)(ssh-deploy-download-handler) )) (global-set-key (kbd "C-c C-z x") (lambda() (interactive)(ssh-deploy-diff-handler) )) (global-set-key (kbd "C-c C-z t") (lambda() (interactive)(ssh-deploy-remote-terminal-handler) )) + (global-set-key (kbd "C-c C-z T") (lambda() (interactive)(ssh-deploy-remote-terminal-eshell-handler) )) (global-set-key (kbd "C-c C-z R") (lambda() (interactive)(ssh-deploy-rename-handler) )) (global-set-key (kbd "C-c C-z e") (lambda() (interactive)(ssh-deploy-remote-changes-handler) )) (global-set-key (kbd "C-c C-z b") (lambda() (interactive)(ssh-deploy-browse-remote-handler) ))) @@ -112,6 +114,7 @@ You can remove the `add-to-list` line if you installed via `MELPA` repository. * If you press `C-c C-z d` you will download the current file or directory from remote host and then reload current buffer. * If you press `C-c C-z D` you will delete the current file or directory after a confirmation on local and remote host. * If you press `C-c C-z t` you will open a terminal with remote host via `tramp-term`. +* If you press `C-c C-z T` you will open a terminal with remote host via `eshell`. * If you press `C-c C-z b` you will browse current directory on remote host in `dired-mode`. * If you press `C-c C-z R` you will rename current file or directory. * If you press `C-c C-z e` you will check for remote changes to the current file. diff --git a/ssh-deploy.el b/ssh-deploy.el index 8372101..5ea249d 100644 --- a/ssh-deploy.el +++ b/ssh-deploy.el @@ -3,8 +3,8 @@ ;; Author: Christian Johansson <github.com/cjohansson> ;; Maintainer: Christian Johansson <github.com/cjohansson> ;; Created: 5 Jul 2016 -;; Modified: 25 Jul 2017 -;; Version: 1.59 +;; Modified: 1 Aug 2017 +;; Version: 1.6 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-ssh-deploy @@ -63,6 +63,7 @@ ;; (global-set-key (kbd "C-c C-z d") (lambda() (interactive)(ssh-deploy-download-handler) )) ;; (global-set-key (kbd "C-c C-z x") (lambda() (interactive)(ssh-deploy-diff-handler) )) ;; (global-set-key (kbd "C-c C-z t") (lambda() (interactive)(ssh-deploy-remote-terminal-handler) )) +;; (global-set-key (kbd "C-c C-z T") (lambda() (interactive)(ssh-deploy-remote-terminal-eshell-handler) )) ;; (global-set-key (kbd "C-c C-z R") (lambda() (interactive)(ssh-deploy-rename-handler) )) ;; (global-set-key (kbd "C-c C-z e") (lambda() (interactive)(ssh-deploy-remote-changes-handler) )) ;; (global-set-key (kbd "C-c C-z b") (lambda() (interactive)(ssh-deploy-browse-remote-handler) )) @@ -526,6 +527,19 @@ (dired command)))))) ;;;### autoload +(defun ssh-deploy-remote-terminal-eshell (local-root remote-root-string path) + "Browse relative to LOCAL-ROOT on REMOTE-ROOT-STRING the path PATH in `dired-mode`." + (if (and (ssh-deploy--file-is-in-path path local-root) + (ssh-deploy--file-is-included path)) + (let ((remote-path (concat remote-root-string (ssh-deploy--get-relative-path local-root path)))) + (let ((remote-root (ssh-deploy--parse-remote remote-path))) + (let ((command (concat "/" (alist-get 'protocol remote-root) ":" (alist-get 'username remote-root) "@" (alist-get 'server remote-root) ":" (alist-get 'path remote-root)))) + (let ((old-directory default-directory)) + (message "Opening eshell on '%s'.." command) + (cd command) + (eshell))))))) + +;;;### autoload (defun ssh-deploy-remote-terminal (remote-host-string) "Opens REMOTE-HOST-STRING in terminal." (let ((remote-root (ssh-deploy--parse-remote remote-host-string))) @@ -715,6 +729,16 @@ (ssh-deploy-remote-terminal ssh-deploy-root-remote))) ;;;### autoload +(defun ssh-deploy-remote-terminal-eshell-handler () + "Open current relative path on remote host in `shell' but only if it's configured for deployment." + (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local) + (ssh-deploy--is-not-empty-string ssh-deploy-root-remote) + (ssh-deploy--is-not-empty-string default-directory)) + (let ((local-path (file-truename default-directory)) + (local-root (file-truename ssh-deploy-root-local))) + (ssh-deploy-remote-terminal-eshell local-root ssh-deploy-root-remote local-path)))) + +;;;### autoload (defun ssh-deploy-browse-remote-handler () "Open current relative path on remote host in `dired-mode' if it is configured for deployment." (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)