[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp/net tramp-smb.el
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] emacs/lisp/net tramp-smb.el |
Date: |
Thu, 08 Oct 2009 15:21:20 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Michael Albinus <albinus> 09/10/08 15:21:19
Modified files:
lisp/net : tramp-smb.el
Log message:
* net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
case both directories are remote.
(tramp-smb-handle-expand-file-name): Implement "~" expansion.
(tramp-smb-maybe-open-connection): Flush the cache only if
necessary.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp-smb.el?cvsroot=emacs&r1=1.53&r2=1.54
Patches:
Index: tramp-smb.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp-smb.el,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- tramp-smb.el 7 Oct 2009 11:30:19 -0000 1.53
+++ tramp-smb.el 8 Oct 2009 15:21:19 -0000 1.54
@@ -218,7 +218,20 @@
(let ((t1 (tramp-tramp-file-p dirname))
(t2 (tramp-tramp-file-p newname)))
(with-parsed-tramp-file-name (if t1 dirname newname) nil
- (if (or (null t1) (null t2))
+ (cond
+ ((and t1 t2)
+ ;; We must copy, using a local temporary directory.
+ (let ((tmpdir
+ (make-temp-name
+ (expand-file-name
+ tramp-temp-name-prefix
+ (tramp-compat-temporary-file-directory)))))
+ (unwind-protect
+ (progn
+ (copy-directory dirname tmpdir keep-date parents)
+ (copy-directory tmpdir newname keep-date parents))
+ (delete-directory tmpdir 'recursive))))
+ ((or t1 t2)
;; We can copy recursively.
(let ((prompt (tramp-smb-send-command v "prompt"))
(recurse (tramp-smb-send-command v "recurse")))
@@ -247,11 +260,11 @@
(tramp-smb-send-command v (format "cd \\"))
;; Toggle prompt and recurse OFF.
(if prompt (tramp-smb-send-command v "prompt"))
- (if recurse (tramp-smb-send-command v "recurse"))))
-
+ (if recurse (tramp-smb-send-command v "recurse")))))
+ (t
;; We must do it file-wise.
(tramp-run-real-handler
- 'copy-directory (list dirname newname keep-date parents))))))
+ 'copy-directory (list dirname newname keep-date parents)))))))
(defun tramp-smb-handle-copy-file
(filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
@@ -400,17 +413,18 @@
(tramp-run-real-handler 'expand-file-name (list name nil))
;; Dissect NAME.
(with-parsed-tramp-file-name name nil
- (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
- (setq localname (concat "/" localname)))
;; Tilde expansion if necessary. We use the user name as share,
- ;; which is offen the case in work groups.
- (when (string-match "\\`~[^/]*" localname)
+ ;; which is offen the case in domains.
+ (when (string-match "\\`/?~\\([^/]*\\)" localname)
(setq localname
(replace-match
- (if (zerop (length (match-string 0 localname)))
+ (if (zerop (length (match-string 1 localname)))
(tramp-file-name-real-user v)
- (match-string 0 localname))
+ (match-string 1 localname))
nil nil localname)))
+ ;; Make the file name absolute.
+ (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
+ (setq localname (concat "/" localname)))
;; No tilde characters in file name, do normal
;; `expand-file-name' (this does "/./" and "/../").
(tramp-make-tramp-file-name
@@ -1000,11 +1014,12 @@
(unless (string-equal
smbclient-version
(tramp-get-connection-property vec "smbclient-version" ""))
+ (when (tramp-get-connection-property vec "smbclient-version" nil)
(tramp-flush-directory-property vec "")
(tramp-flush-connection-property vec)
+); (setq buf (tramp-get-buffer vec)))
(tramp-set-connection-property
- vec "smbclient-version" smbclient-version)
- (setq buf (tramp-get-buffer vec)))))
+ vec "smbclient-version" smbclient-version))))
;; If too much time has passed since last command was sent, look
;; whether there has been an error message; maybe due to
@@ -1089,12 +1104,14 @@
(search-forward-regexp
"Domain=\\[[^]]*\\] OS=\\[[^]]*\\] Server=\\[[^]]*\\]" nil t)
(let ((smbserver-version (match-string 0)))
- (when (not (string-equal
+ (unless (string-equal
smbserver-version
(tramp-get-connection-property
- vec "smbserver-version" "")))
+ vec "smbserver-version" ""))
+ (when (tramp-get-connection-property
+ vec "smbserver-version" nil)
(tramp-flush-directory-property vec "")
- (tramp-flush-connection-property vec)
+ (tramp-flush-connection-property vec))
(tramp-set-connection-property
vec "smbserver-version" smbserver-version))))
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/01
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/02
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/07
- [Emacs-diffs] emacs/lisp/net tramp-smb.el,
Michael Albinus <=
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/11
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/11
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/15
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/16
- [Emacs-diffs] emacs/lisp/net tramp-smb.el, Michael Albinus, 2009/10/21