[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy c04badf 048/173: Moved autoloading functions
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy c04badf 048/173: Moved autoloading functions last, changed parameters for copy functions |
Date: |
Sat, 20 Oct 2018 10:36:28 -0400 (EDT) |
branch: externals/ssh-deploy
commit c04badf78b25e2c13f2e87d5c66a77c2a445c624
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Moved autoloading functions last, changed parameters for copy functions
---
ssh-deploy.el | 137 +++++++++++++++++++++++++++++++---------------------------
1 file changed, 74 insertions(+), 63 deletions(-)
diff --git a/ssh-deploy.el b/ssh-deploy.el
index 877b47f..f61aa0b 100644
--- a/ssh-deploy.el
+++ b/ssh-deploy.el
@@ -4,7 +4,7 @@
;; Maintainer: Christian Johansson <github.com/cjohansson>
;; Created: 5 Jul 2016
;; Modified: 20 Nov 2016
-;; Version: 1.41
+;; Version: 1.42
;; Keywords: tools, convenience
;; URL: https://github.com/cjohansson/emacs-ssh-deploy
@@ -103,34 +103,6 @@
:type 'boolean
:group 'ssh-deploy)
-;;;### 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`."
- (if (ssh-deploy--file-is-in-path path local-root)
- (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))))
- (message "Opening '%s' for browsing on remote host.." command)
- (dired command))))))
-
-;;;### 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)))
- (if (string= (alist-get 'protocol remote-root) "ssh")
- (if (and (fboundp 'tramp-term)
- (fboundp 'tramp-term--initialize)
- (fboundp 'tramp-term--do-ssh-login))
- (progn
- (let ((hostname (concat (alist-get 'username remote-root) "@"
(alist-get 'server remote-root))))
- (let ((host (split-string hostname "@")))
- (message "Opening tramp-terminal for remote host
'address@hidden' and '%s'.." (car host) (car (last host)) hostname)
- (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."))
- (message "Remote terminal is only available for ssh protocol"))))
(defun ssh-deploy--file-is-in-path (file path)
"Return true if FILE is in the path PATH."
@@ -140,28 +112,6 @@
"Return a string for the relative path based on ROOT and PATH."
(replace-regexp-in-string root "" path))
-;;;### autoload
-(defun ssh-deploy-diff (local-root remote-root-string path &optional debug)
- "Find differences relative to the roots LOCAL-ROOT with REMOTE-ROOT-STRING
via ssh and the path PATH, DEBUG enables feedback message."
- (let ((file-or-directory (file-regular-p path)))
- (if (ssh-deploy--file-is-in-path path local-root)
- (progn
- (let ((remote-path (concat remote-root-string
(ssh-deploy--get-relative-path local-root path))))
- (let ((remote (ssh-deploy--parse-remote remote-path)))
- (let ((command (concat "/" (alist-get 'protocol remote) ":"
(alist-get 'username remote) "@" (alist-get 'server remote) ":" (alist-get
'path remote))))
- (if file-or-directory
- (progn
- (message "Comparing file '%s' to '%s'.." path command)
- (ediff path command))
- (progn
- (if (fboundp 'ztree-diff)
- (progn
- (message "Comparing directory '%s' to '%s'.." path
command)
- (ztree-diff path command))
- (message "ztree-diff is not installed.")
- )))))))
- (if debug
- (message "Path '%s' is not in the root '%s'" path local-root)))))
(defun ssh-deploy--parse-remote (string)
"Return alist with connection attributes parsed from STRING."
@@ -206,7 +156,7 @@
(message "Uploading file '%s' to '%s' via tramp
asynchrously.." local remote-path)
(async-start
`(lambda()
- (copy-file ,local ,remote-path t t)
+ (copy-file ,local ,remote-path t t t t)
,local)
(lambda(return-path)
(message "Upload '%s' finished" return-path))))
@@ -227,7 +177,7 @@
(if file-or-directory
(progn
(message "Uploading file '%s' to '%s' via tramp synchrously.." local
remote-path)
- (copy-file local remote-path t t)
+ (copy-file local remote-path t t t t)
(message "Upload '%s' finished" local))
(progn
(message "Uploading directory '%s' to '%s' via tramp synchrously.."
local remote-path)
@@ -245,7 +195,7 @@
(message "Downloading file '%s' to '%s' via tramp
asynchrously.." remote-path local)
(async-start
`(lambda()
- (copy-file ,remote-path ,local t t)
+ (copy-file ,remote-path ,local t t t t)
,local)
(lambda(return-path)
(message "Download '%s' finished" return-path))))
@@ -266,7 +216,7 @@
(if file-or-directory
(progn
(message "Downloading file '%s' to '%s' via tramp synchrously.."
remote-path local)
- (copy-file remote-path local t t)
+ (copy-file remote-path local t t t t)
(message "Download '%s' finished" local))
(progn
(message "Downloading directory '%s' to '%s' via tramp synchrously.."
remote-path local)
@@ -296,8 +246,10 @@
;;;### autoload
(defun ssh-deploy-upload-handler ()
"Upload current path to remote host if it is configured for SSH deployment."
- (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)
(ssh-deploy--is-not-empty-string ssh-deploy-root-remote))
- (if (ssh-deploy--is-not-empty-string buffer-file-name)
+ (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)
+ (ssh-deploy--is-not-empty-string ssh-deploy-root-remote))
+ (if (and (ssh-deploy--is-not-empty-string buffer-file-name)
+ (file-exists-p buffer-file-name))
(let ((local-path (file-truename buffer-file-name))
(local-root (file-truename ssh-deploy-root-local)))
(ssh-deploy local-root ssh-deploy-root-remote t local-path
ssh-deploy-debug ssh-deploy-async))
@@ -309,12 +261,15 @@
;;;### autoload
(defun ssh-deploy-download-handler ()
"Download current path from remote host if it is configured for SSH
deployment."
- (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)
(ssh-deploy--is-not-empty-string ssh-deploy-root-remote))
- (if (ssh-deploy--is-not-empty-string buffer-file-name)
+ (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)
+ (ssh-deploy--is-not-empty-string ssh-deploy-root-remote))
+ (if (and (ssh-deploy--is-not-empty-string buffer-file-name)
+ (file-exists-p buffer-file-name))
(let ((local-path (file-truename buffer-file-name))
(local-root (file-truename ssh-deploy-root-local)))
(ssh-deploy local-root ssh-deploy-root-remote nil local-path
ssh-deploy-debug ssh-deploy-async))
- (if (ssh-deploy--is-not-empty-string default-directory)
+ (if (and (ssh-deploy--is-not-empty-string default-directory)
+ (file-exists-p default-directory))
(let ((local-path (file-truename default-directory))
(local-root (file-truename ssh-deploy-root-local)))
(ssh-deploy local-root ssh-deploy-root-remote nil local-path
ssh-deploy-debug ssh-deploy-async))))))
@@ -323,11 +278,13 @@
(defun ssh-deploy-diff-handler ()
"Compare current path with remote host if it is configured for SSH
deployment."
(if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)
(ssh-deploy--is-not-empty-string ssh-deploy-root-remote))
- (if (ssh-deploy--is-not-empty-string buffer-file-name)
+ (if (and (ssh-deploy--is-not-empty-string buffer-file-name)
+ (file-exists-p buffer-file-name))
(let ((local-path (file-truename buffer-file-name))
(local-root (file-truename ssh-deploy-root-local)))
(ssh-deploy-diff local-root ssh-deploy-root-remote local-path
ssh-deploy-debug))
- (if (ssh-deploy--is-not-empty-string default-directory)
+ (if (and (ssh-deploy--is-not-empty-string default-directory)
+ (file-exists-p default-directory))
(let ((local-path (file-truename default-directory))
(local-root (file-truename ssh-deploy-root-local)))
(ssh-deploy-diff local-root ssh-deploy-root-remote local-path
ssh-deploy-debug))))))
@@ -341,10 +298,64 @@
;;;### autoload
(defun ssh-deploy-browse-remote-handler ()
"Open current relative path on remote host in `dired-mode' if it is
configured for SSH 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))
+ (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-browse-remote local-root ssh-deploy-root-remote
local-path))))
+;;;### autoload
+(defun ssh-deploy-diff (local-root remote-root-string path &optional debug)
+ "Find differences relative to the roots LOCAL-ROOT with REMOTE-ROOT-STRING
via ssh and the path PATH, DEBUG enables feedback message."
+ (let ((file-or-directory (file-regular-p path)))
+ (if (ssh-deploy--file-is-in-path path local-root)
+ (progn
+ (let ((remote-path (concat remote-root-string
(ssh-deploy--get-relative-path local-root path))))
+ (let ((remote (ssh-deploy--parse-remote remote-path)))
+ (let ((command (concat "/" (alist-get 'protocol remote) ":"
(alist-get 'username remote) "@" (alist-get 'server remote) ":" (alist-get
'path remote))))
+ (if file-or-directory
+ (progn
+ (message "Comparing file '%s' to '%s'.." path command)
+ (ediff path command))
+ (progn
+ (if (fboundp 'ztree-diff)
+ (progn
+ (message "Comparing directory '%s' to '%s'.." path
command)
+ (ztree-diff path command))
+ (message "ztree-diff is not installed.")
+ )))))))
+ (if debug
+ (message "Path '%s' is not in the root '%s'" path local-root)))))
+
+;;;### 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`."
+ (if (ssh-deploy--file-is-in-path path local-root)
+ (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))))
+ (message "Opening '%s' for browsing on remote host.." command)
+ (dired command))))))
+
+;;;### 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)))
+ (if (string= (alist-get 'protocol remote-root) "ssh")
+ (if (and (fboundp 'tramp-term)
+ (fboundp 'tramp-term--initialize)
+ (fboundp 'tramp-term--do-ssh-login))
+ (progn
+ (let ((hostname (concat (alist-get 'username remote-root) "@"
(alist-get 'server remote-root))))
+ (let ((host (split-string hostname "@")))
+ (message "Opening tramp-terminal for remote host
'address@hidden' and '%s'.." (car host) (car (last host)) hostname)
+ (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."))
+ (message "Remote terminal is only available for ssh protocol"))))
+
(provide 'ssh-deploy)
;;; ssh-deploy.el ends here
- [elpa] externals/ssh-deploy 97d803d 004/173: Updated comments and changed license in preparation for MELPA submission., (continued)
- [elpa] externals/ssh-deploy 97d803d 004/173: Updated comments and changed license in preparation for MELPA submission., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy de8eadd 067/173: Remote path is not shell escaped on upload and download because it, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 6d1c10c 069/173: Improved documentation, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy ec46610 075/173: Fixed a typo and improved documentation, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy c8b322a 074/173: Fixed markdown syntax, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 5e86b22 072/173: Bug fix for automatically creating missing remote directories on upload, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 4fbe568 084/173: Updated hydra example to prevent lazy loading of package, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 4c35ab7 055/173: Fixed syntax bug in MELPA description, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy d324b9f 046/173: Cleaned up code structure and isolated functions, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 404aa7e 042/173: Transfers now use TRAMP asynchrously, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy c04badf 048/173: Moved autoloading functions last, changed parameters for copy functions,
Stefan Monnier <=
- [elpa] externals/ssh-deploy 3569e5e 058/173: More grammatical fixes for README.md, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 4005d0e 001/173: My initial commit, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 1c1e379 063/173: More improvement on README for force uploads, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 1f0bdf6 071/173: Create directories on remote When uploading files in a folder that, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy b1f9e5b 050/173: Now detects remote changes, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy bf86728 068/173: Added deploy command, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy dbd8608 076/173: Improved documentation, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 2eab0ee 091/173: Fixed bug for eshell in base directory, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy c02b0c9 094/173: Removed debug code from directory-diff function, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 68804ee 097/173: Updated use-package README example, Stefan Monnier, 2018/10/20