branch: externals/ssh-deploy commit af7f33c85fe7d8e6c597fe5c674b1c7bf8ce2bfd Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Launch eshell and dired in base or current directory --- README.md | 16 +++++++++------- ssh-deploy.el | 34 +++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 04853cc..e8dd2e0 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ 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) or built-in `eshell` (SSH) -* Launch remote `eshell` terminals (SSH, FTP) -* Launch remote browsing using `dired-mode` +* Launch remote `eshell` terminals (SSH) in base or relative directory +* Launch remote browsing using `dired-mode` in base or relative directory * 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) * Supports renaming and deletion of files and directories @@ -75,11 +75,12 @@ 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-delete-handler) )) (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-base-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) ))) + (global-set-key (kbd "C-c C-z b") (lambda() (interactive)(ssh-deploy-browse-remote-base-handler) )) + (global-set-key (kbd "C-c C-z B") (lambda() (interactive)(ssh-deploy-browse-remote-handler) ))) ``` You can remove the `add-to-list` line if you installed via `MELPA` repository. @@ -92,9 +93,10 @@ You can remove the `add-to-list` line if you installed via `MELPA` repository. * If you press `C-c C-z u` you will upload local file or directory to remote host. * 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 t` you will open a terminal with remote host in base directory via `eshell`. +* If you press `C-c C-z T` you will open a terminal with remote host in current directory via `eshell`. +* If you press `C-c C-z b` you will browse base directory on remote host in `dired-mode`. +* 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 13622ee..d5c58bc 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: 7 Sep 2017 -;; Version: 1.64 +;; Modified: 26 Sep 2017 +;; Version: 1.65 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-ssh-deploy @@ -57,11 +57,12 @@ ;; (global-set-key (kbd "C-c C-z D") (lambda() (interactive)(ssh-deploy-delete-handler) )) ;; (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-base-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) )) +;; (global-set-key (kbd "C-c C-z b") (lambda() (interactive)(ssh-deploy-browse-remote-base-handler) )) +;; (global-set-key (kbd "C-c C-z B") (lambda() (interactive)(ssh-deploy-browse-remote-handler) )) ;; ;; Here is an example for SSH deployment, /Users/Chris/Web/Site1/.dir.locals.el: ;; ((nil . ( @@ -511,7 +512,7 @@ ;;;### autoload (defun ssh-deploy-browse-remote (local-root remote-root-string path) - "Browse relative to LOCAL-ROOT on REMOTE-ROOT-STRING the path PATH in `dired-mode`." + "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)))) @@ -522,7 +523,7 @@ ;;;### 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`." + "Browse relative to LOCAL-ROOT on REMOTE-ROOT-STRING the path PATH in `eshell-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)))) @@ -745,7 +746,7 @@ ;;;### 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." + "Open current relative path on remote host in `eshell' but only if it's configured for deployment." (interactive) (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local) (ssh-deploy--is-not-empty-string ssh-deploy-root-remote) @@ -755,6 +756,15 @@ (ssh-deploy-remote-terminal-eshell local-root ssh-deploy-root-remote local-path)))) ;;;### autoload +(defun ssh-deploy-remote-terminal-eshell-base-handler () + "Open base path on remote host in `eshell' but only if it's configured for deployment." + (interactive) + (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local) + (ssh-deploy--is-not-empty-string ssh-deploy-root-remote)) + (let ((local-root (file-truename ssh-deploy-root-local))) + (ssh-deploy-remote-terminal-eshell local-root ssh-deploy-root-remote local-root)))) + +;;;### autoload (defun ssh-deploy-browse-remote-handler () "Open current relative path on remote host in `dired-mode' if it is configured for deployment." (interactive) @@ -765,6 +775,16 @@ (local-root (file-truename ssh-deploy-root-local))) (ssh-deploy-browse-remote local-root ssh-deploy-root-remote local-path)))) +;;;### autoload +(defun ssh-deploy-browse-remote-base-handler () + "Open base path on remote host in `dired-mode' if it is configured for deployment." + (interactive) + (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local) + (ssh-deploy--is-not-empty-string ssh-deploy-root-remote)) + (let ((local-root (file-truename ssh-deploy-root-local))) + (ssh-deploy-browse-remote local-root ssh-deploy-root-remote local-root)))) + + ;; Mark variables as safe (put 'ssh-deploy-root-local 'safe-local-variable 'stringp) (put 'ssh-deploy-root-remote 'safe-local-variable 'stringp)