[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy fa368fb 020/173: Made relative path generati
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy fa368fb 020/173: Made relative path generation as stand-alone function and now checks if ztree and tramp-term is installed before trying to call them. |
Date: |
Sat, 20 Oct 2018 10:36:23 -0400 (EDT) |
branch: externals/ssh-deploy
commit fa368fb38e7c35a68d46f2cf37bc8516661aec31
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Made relative path generation as stand-alone function and now checks if
ztree and tramp-term is installed before trying to call them.
---
README.md | 3 +++
ssh-deploy.el | 39 +++++++++++++++++++++++++--------------
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
index f4d9023..6a79ea0 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,9 @@ You can remove the `add-to-list` line if you installed via
`MELPA` repository.
The above configuration uses the plugin `use-package` which I highly recommend.
+## TODO
+* Add notification for remote changes of files
+
## Read more
* <https://www.emacswiki.org/emacs/DirectoryVariables>
* <http://www.gnu.org/software/tramp/>
diff --git a/ssh-deploy.el b/ssh-deploy.el
index b8fabe7..5a2efae 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: 19 Jul 2016
-;; Version: 1.21
+;; Modified: 20 Jul 2016
+;; Version: 1.22
;; Keywords: tools, convenience
;; URL: https://github.com/cjohansson/emacs-ssh-deploy
@@ -82,37 +82,48 @@
(defun ssh-deploy-browse-remote (local-root remote-root path)
"Browse relative to LOCAL-ROOT on REMOTE-ROOT the path PATH in `dired-mode`."
(if (ssh-deploy-file-is-in-path path local-root)
- (let ((remote-path (concat remote-root (replace-regexp-in-string
local-root "" path))))
+ (let ((remote-path (concat remote-root (ssh-deploy-get-relative-path
local-root path))))
(message "Opening '%s' for browsing on remote host.." remote-path)
(dired (concat "/ssh:" remote-path)))))
(defun ssh-deploy-remote-terminal (remote-host)
"Opens REMOTE-HOST in tramp terminal."
- (let ((hostname (replace-regexp-in-string ":.*$" "" remote-host)))
- (let ((host (split-string hostname "@")))
- (message "Opening tramp-terminal for remote host 'address@hidden' or
'%s' translated from '%s'.." (car host) (car (last host)) hostname remote-host)
- (unless (eql (catch 'tramp-term--abort (tramp-term--do-ssh-login host))
'tramp-term--abort)
- (tramp-term--initialize hostname)
- (run-hook-with-args 'tramp-term-after-initialized-hook hostname)
- (message "tramp-term initialized")))))
+ (if (fboundp 'tramp-term)
+ (progn
+ (let ((hostname (replace-regexp-in-string ":.*$" "" remote-host)))
+ (let ((host (split-string hostname "@")))
+ (message "Opening tramp-terminal for remote host 'address@hidden'
or '%s' translated from '%s'.." (car host) (car (last host)) hostname
remote-host)
+ (unless (eql (catch 'tramp-term--abort (tramp-term--do-ssh-login
host)) 'tramp-term--abort)
+ (tramp-term--initialize hostname)
+ (run-hook-with-args 'tramp-term-after-initialized-hook hostname)
+ (message "tramp-term initialized")))))
+ (message "tramp-term is not installed.")))
(defun ssh-deploy-file-is-in-path (file path)
"Return true if FILE is in the path PATH."
(not (null (string-match path file))))
+(defun ssh-deploy-get-relative-path (root path)
+ "Return a string for the relative path based on ROOT and PATH."
+ (replace-regexp-in-string root "" path))
+
(defun ssh-deploy-diff (local-root remote-root path)
"Find differences relative to the roots LOCAL-ROOT with REMOTE-ROOT via ssh
and the path PATH."
(let ((file-or-directory (file-regular-p path)))
(if (ssh-deploy-file-is-in-path path local-root)
(progn
- (let ((remote-path (concat "/ssh:" remote-root
(replace-regexp-in-string local-root "" path))))
+ (let ((remote-path (concat "/ssh:" remote-root
(ssh-deploy-get-relative-path local-root path))))
(if file-or-directory
(progn
(message "Comparing file '%s' to '%s'.." path remote-path)
(ediff path remote-path))
(progn
- (message "Comparing directory '%s' to '%s'.." path remote-path)
- (ztree-diff path remote-path)))))
+ (if (fboundp 'ztree-diff)
+ (progn
+ (message "Comparing directory '%s' to '%s'.." path
remote-path)
+ (ztree-diff path remote-path))
+ (message "ztree-diff is not installed.")
+ )))))
(if ssh-deploy-debug
(message "Path '%s' is not in the root '%s'" path local-root)))))
@@ -124,7 +135,7 @@
(defun ssh-deploy (local-root remote-root upload-or-download path)
"Upload/Download relative to the roots LOCAL-ROOT with REMOTE-ROOT via SSH
according to UPLOAD-OR-DOWNLOAD and the path PATH."
(let ((file-or-directory (file-regular-p path)))
- (let ((remote-path (concat remote-root (replace-regexp-in-string
local-root "" path))))
+ (let ((remote-path (concat remote-root (ssh-deploy-get-relative-path
local-root path))))
(if (ssh-deploy-file-is-in-path path local-root)
(progn
(if (not (null upload-or-download))
- [elpa] externals/ssh-deploy 36186d6 002/173: Replaced sync references with deploy, (continued)
- [elpa] externals/ssh-deploy 36186d6 002/173: Replaced sync references with deploy, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 952abf0 021/173: Changed reference to zdiff-tree to ztree-diff and added more checks to see if tramp-term is installed before calling it., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 3fbd479 013/173: Changed variable-name typo explicity-save to explicit-save and updated README., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 7133863 024/173: Fixed typos, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 8faa3c1 018/173: Now checks in path is in local-root before browsing remote host., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 3bbbbfb 017/173: *** empty log message ***, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy f77eba5 012/173: Updated README with proper setup example and instructions about MELPA., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 5ad07f2 008/173: Changed requirements., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 1ebf003 010/173: Formatted text a bit better., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy ebdbb7e 014/173: Add TRAMP protocol for difference queries, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy fa368fb 020/173: Made relative path generation as stand-alone function and now checks if ztree and tramp-term is installed before trying to call them.,
Stefan Monnier <=
- [elpa] externals/ssh-deploy f4ad77d 026/173: Now works asynchrously, moved (revert-buffer) to successful downloads instead of to key-binding., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 05ed4c8 009/173: Made changes to comply with MELPA guidelines., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 89fb82a 038/173: Fixed bug when downloading via SSH to a local path containing whitespaces, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 965c68f 028/173: Centralized asynchronous shell commands., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy e6e1ad8 039/173: Updated version and modified date, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 2257f95 029/173: Fixed upload and downloads of root directories where local root directory name differs from remote root directory name., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 560ff1d 037/173: Added TRAMP functions and improved messages., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy a86091c 032/173: Broken down diff function into multiple functions to easily add new protocols., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 1e58dc3 040/173: SSH deployment now works via TRAMP instead of SCP, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 4a2f947 053/173: Fixed bug where missing remote file used wrong logic, Stefan Monnier, 2018/10/20