aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2012-10-09 14:49:02 +0200
committerMichael Albinus2012-10-09 14:49:02 +0200
commit1d51f99c52d3d4f702dcefa80fad2956caac5f48 (patch)
tree559ddf77ea7b16e46d49d13edd5d522905cd4ad3
parentbf05ed1f9ece919197cd5a0c2b9c65b1a3fbb22c (diff)
downloademacs-1d51f99c52d3d4f702dcefa80fad2956caac5f48.tar.gz
emacs-1d51f99c52d3d4f702dcefa80fad2956caac5f48.zip
* net/tramp.el (tramp-debug-message): Remove
"tramp-with-progress-reporter" from regexp of ignored functions. (with-tramp-progress-reporter): Rename from `tramp-with-progress-reporter'. (with-tramp-file-property, with-tramp-connection-property): Move from tramp-cache.el, rename from `with-file-property' and `with-connection-property', respectively. * net/tramp-cache.el: Remove `with-file-property' and `with-connection-property'. * net/tramp.el: * net/tramp-gvfs.el: * net/tramp-sh.el: * net/tramp-smb.el: Adapt callees. * net/trampver.el: Update release number.
-rw-r--r--lisp/ChangeLog20
-rw-r--r--lisp/net/tramp-cache.el39
-rw-r--r--lisp/net/tramp-gvfs.el8
-rw-r--r--lisp/net/tramp-sh.el95
-rw-r--r--lisp/net/tramp-smb.el23
-rw-r--r--lisp/net/tramp.el55
-rw-r--r--lisp/net/trampver.el4
7 files changed, 131 insertions, 113 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ffd224c9b6c..1b42ae36839 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,23 @@
12012-10-09 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-debug-message): Remove
4 "tramp-with-progress-reporter" from regexp of ignored functions.
5 (with-tramp-progress-reporter): Rename from
6 `tramp-with-progress-reporter'.
7 (with-tramp-file-property, with-tramp-connection-property): Move
8 from tramp-cache.el, rename from `with-file-property' and
9 `with-connection-property', respectively.
10
11 * net/tramp-cache.el: Remove `with-file-property' and
12 `with-connection-property'.
13
14 * net/tramp.el:
15 * net/tramp-gvfs.el:
16 * net/tramp-sh.el:
17 * net/tramp-smb.el: Adapt callees.
18
19 * net/trampver.el: Update release number.
20
12012-10-09 Glenn Morris <rgm@gnu.org> 212012-10-09 Glenn Morris <rgm@gnu.org>
2 22
3 * w32-fns.el (set-message-beep): 23 * w32-fns.el (set-message-beep):
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index fe5eb0049d0..e4fca46ce2d 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -139,27 +139,6 @@ Returns VALUE."
139 value)) 139 value))
140 140
141;;;###tramp-autoload 141;;;###tramp-autoload
142(defmacro with-file-property (vec file property &rest body)
143 "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
144FILE must be a local file name on a connection identified via VEC."
145 `(if (file-name-absolute-p ,file)
146 (let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
147 (when (eq value 'undef)
148 ;; We cannot pass @body as parameter to
149 ;; `tramp-set-file-property' because it mangles our
150 ;; debug messages.
151 (setq value (progn ,@body))
152 (tramp-set-file-property ,vec ,file ,property value))
153 value)
154 ,@body))
155
156;;;###tramp-autoload
157(put 'with-file-property 'lisp-indent-function 3)
158(put 'with-file-property 'edebug-form-spec t)
159(tramp-compat-font-lock-add-keywords
160 'emacs-lisp-mode '("\\<with-file-property\\>"))
161
162;;;###tramp-autoload
163(defun tramp-flush-file-property (vec file) 142(defun tramp-flush-file-property (vec file)
164 "Remove all properties of FILE in the cache context of VEC." 143 "Remove all properties of FILE in the cache context of VEC."
165 ;; Remove file property of symlinks. 144 ;; Remove file property of symlinks.
@@ -250,24 +229,6 @@ PROPERTY is set persistent when KEY is a vector."
250 value)) 229 value))
251 230
252;;;###tramp-autoload 231;;;###tramp-autoload
253(defmacro with-connection-property (key property &rest body)
254 "Check in Tramp for property PROPERTY, otherwise executes BODY and set."
255 `(let ((value (tramp-get-connection-property ,key ,property 'undef)))
256 (when (eq value 'undef)
257 ;; We cannot pass ,@body as parameter to
258 ;; `tramp-set-connection-property' because it mangles our debug
259 ;; messages.
260 (setq value (progn ,@body))
261 (tramp-set-connection-property ,key ,property value))
262 value))
263
264;;;###tramp-autoload
265(put 'with-connection-property 'lisp-indent-function 2)
266(put 'with-connection-property 'edebug-form-spec t)
267(tramp-compat-font-lock-add-keywords
268 'emacs-lisp-mode '("\\<with-connection-property\\>"))
269
270;;;###tramp-autoload
271(defun tramp-flush-connection-property (key) 232(defun tramp-flush-connection-property (key)
272 "Remove all properties identified by KEY. 233 "Remove all properties identified by KEY.
273KEY identifies the connection, it is either a process or a vector." 234KEY identifies the connection, it is either a process or a vector."
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index f78122ec704..60b39606d86 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -537,7 +537,7 @@ is no information where to trace the message.")
537 "Like `copy-file' for Tramp files." 537 "Like `copy-file' for Tramp files."
538 (with-parsed-tramp-file-name 538 (with-parsed-tramp-file-name
539 (if (tramp-tramp-file-p filename) filename newname) nil 539 (if (tramp-tramp-file-p filename) filename newname) nil
540 (tramp-with-progress-reporter 540 (with-tramp-progress-reporter
541 v 0 (format "Copying %s to %s" filename newname) 541 v 0 (format "Copying %s to %s" filename newname)
542 (condition-case err 542 (condition-case err
543 (let ((args 543 (let ((args
@@ -741,7 +741,7 @@ is no information where to trace the message.")
741 "Like `rename-file' for Tramp files." 741 "Like `rename-file' for Tramp files."
742 (with-parsed-tramp-file-name 742 (with-parsed-tramp-file-name
743 (if (tramp-tramp-file-p filename) filename newname) nil 743 (if (tramp-tramp-file-p filename) filename newname) nil
744 (tramp-with-progress-reporter 744 (with-tramp-progress-reporter
745 v 0 (format "Renaming %s to %s" filename newname) 745 v 0 (format "Renaming %s to %s" filename newname)
746 (condition-case err 746 (condition-case err
747 (rename-file 747 (rename-file
@@ -1056,7 +1056,7 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
1056 (catch 'mounted 1056 (catch 'mounted
1057 (dolist 1057 (dolist
1058 (elt 1058 (elt
1059 (with-file-property vec "/" "list-mounts" 1059 (with-tramp-file-property vec "/" "list-mounts"
1060 (with-tramp-dbus-call-method vec t 1060 (with-tramp-dbus-call-method vec t
1061 :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker 1061 :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
1062 tramp-gvfs-interface-mounttracker "listMounts")) 1062 tramp-gvfs-interface-mounttracker "listMounts"))
@@ -1199,7 +1199,7 @@ connection if a previous connection has died for some reason."
1199 (tramp-gvfs-object-path 1199 (tramp-gvfs-object-path
1200 (tramp-make-tramp-file-name method user host "")))) 1200 (tramp-make-tramp-file-name method user host ""))))
1201 1201
1202 (tramp-with-progress-reporter 1202 (with-tramp-progress-reporter
1203 vec 3 1203 vec 3
1204 (if (zerop (length user)) 1204 (if (zerop (length user))
1205 (format "Opening connection for %s using %s" host method) 1205 (format "Opening connection for %s using %s" host method)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 2c1af3e83fa..ec321d00506 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1058,7 +1058,7 @@ target of the symlink differ."
1058 "Like `file-truename' for Tramp files." 1058 "Like `file-truename' for Tramp files."
1059 (with-parsed-tramp-file-name (expand-file-name filename) nil 1059 (with-parsed-tramp-file-name (expand-file-name filename) nil
1060 (tramp-make-tramp-file-name method user host 1060 (tramp-make-tramp-file-name method user host
1061 (with-file-property v localname "file-truename" 1061 (with-tramp-file-property v localname "file-truename"
1062 (let ((result nil)) ; result steps in reverse order 1062 (let ((result nil)) ; result steps in reverse order
1063 (tramp-message v 4 "Finding true name for `%s'" filename) 1063 (tramp-message v 4 "Finding true name for `%s'" filename)
1064 (cond 1064 (cond
@@ -1167,7 +1167,7 @@ target of the symlink differ."
1167(defun tramp-sh-handle-file-exists-p (filename) 1167(defun tramp-sh-handle-file-exists-p (filename)
1168 "Like `file-exists-p' for Tramp files." 1168 "Like `file-exists-p' for Tramp files."
1169 (with-parsed-tramp-file-name filename nil 1169 (with-parsed-tramp-file-name filename nil
1170 (with-file-property v localname "file-exists-p" 1170 (with-tramp-file-property v localname "file-exists-p"
1171 (or (not (null (tramp-get-file-property 1171 (or (not (null (tramp-get-file-property
1172 v localname "file-attributes-integer" nil))) 1172 v localname "file-attributes-integer" nil)))
1173 (not (null (tramp-get-file-property 1173 (not (null (tramp-get-file-property
@@ -1185,7 +1185,8 @@ target of the symlink differ."
1185 ;; Don't modify `last-coding-system-used' by accident. 1185 ;; Don't modify `last-coding-system-used' by accident.
1186 (let ((last-coding-system-used last-coding-system-used)) 1186 (let ((last-coding-system-used last-coding-system-used))
1187 (with-parsed-tramp-file-name (expand-file-name filename) nil 1187 (with-parsed-tramp-file-name (expand-file-name filename) nil
1188 (with-file-property v localname (format "file-attributes-%s" id-format) 1188 (with-tramp-file-property
1189 v localname (format "file-attributes-%s" id-format)
1189 (save-excursion 1190 (save-excursion
1190 (tramp-convert-file-attributes 1191 (tramp-convert-file-attributes
1191 v 1192 v
@@ -1481,7 +1482,8 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1481 1482
1482(defun tramp-remote-selinux-p (vec) 1483(defun tramp-remote-selinux-p (vec)
1483 "Check, whether SELINUX is enabled on the remote host." 1484 "Check, whether SELINUX is enabled on the remote host."
1484 (with-connection-property (tramp-get-connection-process vec) "selinux-p" 1485 (with-tramp-connection-property
1486 (tramp-get-connection-process vec) "selinux-p"
1485 (let ((result (tramp-find-executable 1487 (let ((result (tramp-find-executable
1486 vec "getenforce" (tramp-get-remote-path vec) t t))) 1488 vec "getenforce" (tramp-get-remote-path vec) t t)))
1487 (and result 1489 (and result
@@ -1493,7 +1495,7 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1493(defun tramp-sh-handle-file-selinux-context (filename) 1495(defun tramp-sh-handle-file-selinux-context (filename)
1494 "Like `file-selinux-context' for Tramp files." 1496 "Like `file-selinux-context' for Tramp files."
1495 (with-parsed-tramp-file-name filename nil 1497 (with-parsed-tramp-file-name filename nil
1496 (with-file-property v localname "file-selinux-context" 1498 (with-tramp-file-property v localname "file-selinux-context"
1497 (let ((context '(nil nil nil nil)) 1499 (let ((context '(nil nil nil nil))
1498 (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):" 1500 (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):"
1499 "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)"))) 1501 "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)")))
@@ -1537,7 +1539,7 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1537(defun tramp-sh-handle-file-executable-p (filename) 1539(defun tramp-sh-handle-file-executable-p (filename)
1538 "Like `file-executable-p' for Tramp files." 1540 "Like `file-executable-p' for Tramp files."
1539 (with-parsed-tramp-file-name filename nil 1541 (with-parsed-tramp-file-name filename nil
1540 (with-file-property v localname "file-executable-p" 1542 (with-tramp-file-property v localname "file-executable-p"
1541 ;; Examine `file-attributes' cache to see if request can be 1543 ;; Examine `file-attributes' cache to see if request can be
1542 ;; satisfied without remote operation. 1544 ;; satisfied without remote operation.
1543 (or (tramp-check-cached-permissions v ?x) 1545 (or (tramp-check-cached-permissions v ?x)
@@ -1546,7 +1548,7 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1546(defun tramp-sh-handle-file-readable-p (filename) 1548(defun tramp-sh-handle-file-readable-p (filename)
1547 "Like `file-readable-p' for Tramp files." 1549 "Like `file-readable-p' for Tramp files."
1548 (with-parsed-tramp-file-name filename nil 1550 (with-parsed-tramp-file-name filename nil
1549 (with-file-property v localname "file-readable-p" 1551 (with-tramp-file-property v localname "file-readable-p"
1550 ;; Examine `file-attributes' cache to see if request can be 1552 ;; Examine `file-attributes' cache to see if request can be
1551 ;; satisfied without remote operation. 1553 ;; satisfied without remote operation.
1552 (or (tramp-check-cached-permissions v ?r) 1554 (or (tramp-check-cached-permissions v ?r)
@@ -1600,13 +1602,13 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1600 ;; desirable to return t immediately for "/method:foo:". It can 1602 ;; desirable to return t immediately for "/method:foo:". It can
1601 ;; be expected that this is always a directory. 1603 ;; be expected that this is always a directory.
1602 (or (zerop (length localname)) 1604 (or (zerop (length localname))
1603 (with-file-property v localname "file-directory-p" 1605 (with-tramp-file-property v localname "file-directory-p"
1604 (tramp-run-test "-d" filename))))) 1606 (tramp-run-test "-d" filename)))))
1605 1607
1606(defun tramp-sh-handle-file-writable-p (filename) 1608(defun tramp-sh-handle-file-writable-p (filename)
1607 "Like `file-writable-p' for Tramp files." 1609 "Like `file-writable-p' for Tramp files."
1608 (with-parsed-tramp-file-name filename nil 1610 (with-parsed-tramp-file-name filename nil
1609 (with-file-property v localname "file-writable-p" 1611 (with-tramp-file-property v localname "file-writable-p"
1610 (if (file-exists-p filename) 1612 (if (file-exists-p filename)
1611 ;; Examine `file-attributes' cache to see if request can be 1613 ;; Examine `file-attributes' cache to see if request can be
1612 ;; satisfied without remote operation. 1614 ;; satisfied without remote operation.
@@ -1619,7 +1621,7 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1619(defun tramp-sh-handle-file-ownership-preserved-p (filename) 1621(defun tramp-sh-handle-file-ownership-preserved-p (filename)
1620 "Like `file-ownership-preserved-p' for Tramp files." 1622 "Like `file-ownership-preserved-p' for Tramp files."
1621 (with-parsed-tramp-file-name filename nil 1623 (with-parsed-tramp-file-name filename nil
1622 (with-file-property v localname "file-ownership-preserved-p" 1624 (with-tramp-file-property v localname "file-ownership-preserved-p"
1623 (let ((attributes (file-attributes filename))) 1625 (let ((attributes (file-attributes filename)))
1624 ;; Return t if the file doesn't exist, since it's true that no 1626 ;; Return t if the file doesn't exist, since it's true that no
1625 ;; information would be lost by an (attempted) delete and create. 1627 ;; information would be lost by an (attempted) delete and create.
@@ -1637,7 +1639,7 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1637 (let* ((temp 1639 (let* ((temp
1638 (copy-tree 1640 (copy-tree
1639 (with-parsed-tramp-file-name directory nil 1641 (with-parsed-tramp-file-name directory nil
1640 (with-file-property 1642 (with-tramp-file-property
1641 v localname 1643 v localname
1642 (format "directory-files-and-attributes-%s" id-format) 1644 (format "directory-files-and-attributes-%s" id-format)
1643 (save-excursion 1645 (save-excursion
@@ -1987,7 +1989,7 @@ file names."
1987 (tramp-error 1989 (tramp-error
1988 v 'file-already-exists "File %s already exists" newname)) 1990 v 'file-already-exists "File %s already exists" newname))
1989 1991
1990 (tramp-with-progress-reporter 1992 (with-tramp-progress-reporter
1991 v 0 (format "%s %s to %s" 1993 v 0 (format "%s %s to %s"
1992 (if (eq op 'copy) "Copying" "Renaming") 1994 (if (eq op 'copy) "Copying" "Renaming")
1993 filename newname) 1995 filename newname)
@@ -2505,7 +2507,7 @@ This is like `dired-recursive-delete-directory' for Tramp files."
2505 nil) 2507 nil)
2506 ((and suffix (nth 2 suffix)) 2508 ((and suffix (nth 2 suffix))
2507 ;; We found an uncompression rule. 2509 ;; We found an uncompression rule.
2508 (tramp-with-progress-reporter 2510 (with-tramp-progress-reporter
2509 v 0 (format "Uncompressing %s" file) 2511 v 0 (format "Uncompressing %s" file)
2510 (when (tramp-send-command-and-check 2512 (when (tramp-send-command-and-check
2511 v (concat (nth 2 suffix) " " 2513 v (concat (nth 2 suffix) " "
@@ -2517,7 +2519,7 @@ This is like `dired-recursive-delete-directory' for Tramp files."
2517 (t 2519 (t
2518 ;; We don't recognize the file as compressed, so compress it. 2520 ;; We don't recognize the file as compressed, so compress it.
2519 ;; Try gzip. 2521 ;; Try gzip.
2520 (tramp-with-progress-reporter v 0 (format "Compressing %s" file) 2522 (with-tramp-progress-reporter v 0 (format "Compressing %s" file)
2521 (when (tramp-send-command-and-check 2523 (when (tramp-send-command-and-check
2522 v (concat "gzip -f " 2524 v (concat "gzip -f "
2523 (tramp-shell-quote-argument localname))) 2525 (tramp-shell-quote-argument localname)))
@@ -2673,7 +2675,7 @@ the result will be a local, non-Tramp, filename."
2673 (string-match "\\`su\\(do\\)?\\'" method)) 2675 (string-match "\\`su\\(do\\)?\\'" method))
2674 (setq uname (concat uname user))) 2676 (setq uname (concat uname user)))
2675 (setq uname 2677 (setq uname
2676 (with-connection-property v uname 2678 (with-tramp-connection-property v uname
2677 (tramp-send-command 2679 (tramp-send-command
2678 v (format "cd %s; pwd" (tramp-shell-quote-argument uname))) 2680 v (format "cd %s; pwd" (tramp-shell-quote-argument uname)))
2679 (with-current-buffer (tramp-get-buffer v) 2681 (with-current-buffer (tramp-get-buffer v)
@@ -2943,7 +2945,7 @@ the result will be a local, non-Tramp, filename."
2943 ;; Use inline encoding for file transfer. 2945 ;; Use inline encoding for file transfer.
2944 (rem-enc 2946 (rem-enc
2945 (save-excursion 2947 (save-excursion
2946 (tramp-with-progress-reporter 2948 (with-tramp-progress-reporter
2947 v 3 (format "Encoding remote file %s" filename) 2949 v 3 (format "Encoding remote file %s" filename)
2948 (tramp-barf-unless-okay 2950 (tramp-barf-unless-okay
2949 v (format rem-enc (tramp-shell-quote-argument localname)) 2951 v (format rem-enc (tramp-shell-quote-argument localname))
@@ -2957,7 +2959,7 @@ the result will be a local, non-Tramp, filename."
2957 (with-temp-buffer 2959 (with-temp-buffer
2958 (set-buffer-multibyte nil) 2960 (set-buffer-multibyte nil)
2959 (insert-buffer-substring (tramp-get-buffer v)) 2961 (insert-buffer-substring (tramp-get-buffer v))
2960 (tramp-with-progress-reporter 2962 (with-tramp-progress-reporter
2961 v 3 (format "Decoding remote file %s with function %s" 2963 v 3 (format "Decoding remote file %s with function %s"
2962 filename loc-dec) 2964 filename loc-dec)
2963 (funcall loc-dec (point-min) (point-max)) 2965 (funcall loc-dec (point-min) (point-max))
@@ -2975,7 +2977,7 @@ the result will be a local, non-Tramp, filename."
2975 (let (file-name-handler-alist 2977 (let (file-name-handler-alist
2976 (coding-system-for-write 'binary)) 2978 (coding-system-for-write 'binary))
2977 (write-region (point-min) (point-max) tmpfile2)) 2979 (write-region (point-min) (point-max) tmpfile2))
2978 (tramp-with-progress-reporter 2980 (with-tramp-progress-reporter
2979 v 3 (format "Decoding remote file %s with command %s" 2981 v 3 (format "Decoding remote file %s with command %s"
2980 filename loc-dec) 2982 filename loc-dec)
2981 (unwind-protect 2983 (unwind-protect
@@ -3203,7 +3205,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3203 (set-buffer-multibyte nil) 3205 (set-buffer-multibyte nil)
3204 ;; Use encoding function or command. 3206 ;; Use encoding function or command.
3205 (if (functionp loc-enc) 3207 (if (functionp loc-enc)
3206 (tramp-with-progress-reporter 3208 (with-tramp-progress-reporter
3207 v 3 (format "Encoding region using function `%s'" 3209 v 3 (format "Encoding region using function `%s'"
3208 loc-enc) 3210 loc-enc)
3209 (let ((coding-system-for-read 'binary)) 3211 (let ((coding-system-for-read 'binary))
@@ -3221,7 +3223,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3221 (tramp-compat-temporary-file-directory))) 3223 (tramp-compat-temporary-file-directory)))
3222 (funcall loc-enc (point-min) (point-max)))) 3224 (funcall loc-enc (point-min) (point-max))))
3223 3225
3224 (tramp-with-progress-reporter 3226 (with-tramp-progress-reporter
3225 v 3 (format "Encoding region using command `%s'" 3227 v 3 (format "Encoding region using command `%s'"
3226 loc-enc) 3228 loc-enc)
3227 (unless (zerop (tramp-call-local-coding-command 3229 (unless (zerop (tramp-call-local-coding-command
@@ -3235,7 +3237,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3235 ;; Send buffer into remote decoding command which 3237 ;; Send buffer into remote decoding command which
3236 ;; writes to remote file. Because this happens on 3238 ;; writes to remote file. Because this happens on
3237 ;; the remote host, we cannot use the function. 3239 ;; the remote host, we cannot use the function.
3238 (tramp-with-progress-reporter 3240 (with-tramp-progress-reporter
3239 v 3 3241 v 3
3240 (format "Decoding region into remote file %s" filename) 3242 (format "Decoding region into remote file %s" filename)
3241 (goto-char (point-max)) 3243 (goto-char (point-max))
@@ -3335,7 +3337,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3335 "Like `vc-registered' for Tramp files." 3337 "Like `vc-registered' for Tramp files."
3336 (tramp-compat-with-temp-message "" 3338 (tramp-compat-with-temp-message ""
3337 (with-parsed-tramp-file-name file nil 3339 (with-parsed-tramp-file-name file nil
3338 (tramp-with-progress-reporter 3340 (with-tramp-progress-reporter
3339 v 3 (format "Checking `vc-registered' for %s" file) 3341 v 3 (format "Checking `vc-registered' for %s" file)
3340 3342
3341 ;; There could be new files, created by the vc backend. We 3343 ;; There could be new files, created by the vc backend. We
@@ -3433,7 +3435,7 @@ Only send the definition if it has not already been done."
3433 (let ((scripts (tramp-get-connection-property 3435 (let ((scripts (tramp-get-connection-property
3434 (tramp-get-connection-process vec) "scripts" nil))) 3436 (tramp-get-connection-process vec) "scripts" nil)))
3435 (unless (member name scripts) 3437 (unless (member name scripts)
3436 (tramp-with-progress-reporter vec 5 (format "Sending script `%s'" name) 3438 (with-tramp-progress-reporter vec 5 (format "Sending script `%s'" name)
3437 ;; The script could contain a call of Perl. This is masked with `%s'. 3439 ;; The script could contain a call of Perl. This is masked with `%s'.
3438 (tramp-barf-unless-okay 3440 (tramp-barf-unless-okay
3439 vec 3441 vec
@@ -3602,7 +3604,7 @@ file exists and nonzero exit status otherwise."
3602 3604
3603(defun tramp-open-shell (vec shell) 3605(defun tramp-open-shell (vec shell)
3604 "Opens shell SHELL." 3606 "Opens shell SHELL."
3605 (tramp-with-progress-reporter 3607 (with-tramp-progress-reporter
3606 vec 5 (format "Opening remote shell `%s'" shell) 3608 vec 5 (format "Opening remote shell `%s'" shell)
3607 ;; Find arguments for this shell. 3609 ;; Find arguments for this shell.
3608 (let ((tramp-end-of-output tramp-initial-end-of-output) 3610 (let ((tramp-end-of-output tramp-initial-end-of-output)
@@ -3638,7 +3640,7 @@ file exists and nonzero exit status otherwise."
3638 (tramp-file-name-method vec) 'tramp-remote-shell))) 3640 (tramp-file-name-method vec) 'tramp-remote-shell)))
3639 shell) 3641 shell)
3640 (setq shell 3642 (setq shell
3641 (with-connection-property vec "remote-shell" 3643 (with-tramp-connection-property vec "remote-shell"
3642 ;; CCC: "root" does not exist always, see QNAP 459. 3644 ;; CCC: "root" does not exist always, see QNAP 459.
3643 ;; Which check could we apply instead? 3645 ;; Which check could we apply instead?
3644 (tramp-send-command vec "echo ~root" t) 3646 (tramp-send-command vec "echo ~root" t)
@@ -3673,7 +3675,7 @@ file exists and nonzero exit status otherwise."
3673 (tramp-open-shell vec shell)) 3675 (tramp-open-shell vec shell))
3674 3676
3675 ;; Busyboxes tend to behave strange. We check for the existence. 3677 ;; Busyboxes tend to behave strange. We check for the existence.
3676 (with-connection-property vec "busybox" 3678 (with-tramp-connection-property vec "busybox"
3677 (tramp-send-command vec (format "%s --version" shell) t) 3679 (tramp-send-command vec (format "%s --version" shell) t)
3678 (let ((case-fold-search t)) 3680 (let ((case-fold-search t))
3679 (and (string-match "busybox" (buffer-string)) t)))))) 3681 (and (string-match "busybox" (buffer-string)) t))))))
@@ -3798,7 +3800,7 @@ process to set up. VEC specifies the connection."
3798 ;; successfully, sending 625 bytes failed. Emacs makes a hack when 3800 ;; successfully, sending 625 bytes failed. Emacs makes a hack when
3799 ;; this host type is detected locally. It cannot handle remote 3801 ;; this host type is detected locally. It cannot handle remote
3800 ;; hosts, though. 3802 ;; hosts, though.
3801 (with-connection-property proc "chunksize" 3803 (with-tramp-connection-property proc "chunksize"
3802 (cond 3804 (cond
3803 ((and (integerp tramp-chunksize) (> tramp-chunksize 0)) 3805 ((and (integerp tramp-chunksize) (> tramp-chunksize 0))
3804 tramp-chunksize) 3806 tramp-chunksize)
@@ -4327,7 +4329,7 @@ connection if a previous connection has died for some reason."
4327 (when (and (boundp 'non-essential) (symbol-value 'non-essential)) 4329 (when (and (boundp 'non-essential) (symbol-value 'non-essential))
4328 (throw 'non-essential 'non-essential)) 4330 (throw 'non-essential 'non-essential))
4329 4331
4330 (tramp-with-progress-reporter 4332 (with-tramp-progress-reporter
4331 vec 3 4333 vec 3
4332 (if (zerop (length (tramp-file-name-user vec))) 4334 (if (zerop (length (tramp-file-name-user vec)))
4333 (format "Opening connection for %s using %s" 4335 (format "Opening connection for %s using %s"
@@ -4773,7 +4775,7 @@ This is used internally by `tramp-file-mode-from-int'."
4773;; Variables local to connection. 4775;; Variables local to connection.
4774 4776
4775(defun tramp-get-remote-path (vec) 4777(defun tramp-get-remote-path (vec)
4776 (with-connection-property 4778 (with-tramp-connection-property
4777 ;; When `tramp-own-remote-path' is in `tramp-remote-path', we 4779 ;; When `tramp-own-remote-path' is in `tramp-remote-path', we
4778 ;; cache the result for the session only. Otherwise, the result 4780 ;; cache the result for the session only. Otherwise, the result
4779 ;; is cached persistently. 4781 ;; is cached persistently.
@@ -4845,7 +4847,7 @@ This is used internally by `tramp-file-mode-from-int'."
4845 remote-path))))) 4847 remote-path)))))
4846 4848
4847(defun tramp-get-ls-command (vec) 4849(defun tramp-get-ls-command (vec)
4848 (with-connection-property vec "ls" 4850 (with-tramp-connection-property vec "ls"
4849 (tramp-message vec 5 "Finding a suitable `ls' command") 4851 (tramp-message vec 5 "Finding a suitable `ls' command")
4850 (or 4852 (or
4851 (catch 'ls-found 4853 (catch 'ls-found
@@ -4871,7 +4873,7 @@ This is used internally by `tramp-file-mode-from-int'."
4871 4873
4872(defun tramp-get-ls-command-with-dired (vec) 4874(defun tramp-get-ls-command-with-dired (vec)
4873 (save-match-data 4875 (save-match-data
4874 (with-connection-property vec "ls-dired" 4876 (with-tramp-connection-property vec "ls-dired"
4875 (tramp-message vec 5 "Checking, whether `ls --dired' works") 4877 (tramp-message vec 5 "Checking, whether `ls --dired' works")
4876 ;; Some "ls" versions are sensible wrt the order of arguments, 4878 ;; Some "ls" versions are sensible wrt the order of arguments,
4877 ;; they fail when "-al" is after the "--dired" argument (for 4879 ;; they fail when "-al" is after the "--dired" argument (for
@@ -4880,7 +4882,7 @@ This is used internally by `tramp-file-mode-from-int'."
4880 vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec)))))) 4882 vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec))))))
4881 4883
4882(defun tramp-get-test-command (vec) 4884(defun tramp-get-test-command (vec)
4883 (with-connection-property vec "test" 4885 (with-tramp-connection-property vec "test"
4884 (tramp-message vec 5 "Finding a suitable `test' command") 4886 (tramp-message vec 5 "Finding a suitable `test' command")
4885 (if (tramp-send-command-and-check vec "test 0") 4887 (if (tramp-send-command-and-check vec "test 0")
4886 "test" 4888 "test"
@@ -4890,7 +4892,7 @@ This is used internally by `tramp-file-mode-from-int'."
4890 ;; Does `test A -nt B' work? Use abominable `find' construct if it 4892 ;; Does `test A -nt B' work? Use abominable `find' construct if it
4891 ;; doesn't. BSD/OS 4.0 wants the parentheses around the command, 4893 ;; doesn't. BSD/OS 4.0 wants the parentheses around the command,
4892 ;; for otherwise the shell crashes. 4894 ;; for otherwise the shell crashes.
4893 (with-connection-property vec "test-nt" 4895 (with-tramp-connection-property vec "test-nt"
4894 (or 4896 (or
4895 (progn 4897 (progn
4896 (tramp-send-command 4898 (tramp-send-command
@@ -4908,17 +4910,17 @@ This is used internally by `tramp-file-mode-from-int'."
4908 "tramp_test_nt %s %s")))) 4910 "tramp_test_nt %s %s"))))
4909 4911
4910(defun tramp-get-file-exists-command (vec) 4912(defun tramp-get-file-exists-command (vec)
4911 (with-connection-property vec "file-exists" 4913 (with-tramp-connection-property vec "file-exists"
4912 (tramp-message vec 5 "Finding command to check if file exists") 4914 (tramp-message vec 5 "Finding command to check if file exists")
4913 (tramp-find-file-exists-command vec))) 4915 (tramp-find-file-exists-command vec)))
4914 4916
4915(defun tramp-get-remote-ln (vec) 4917(defun tramp-get-remote-ln (vec)
4916 (with-connection-property vec "ln" 4918 (with-tramp-connection-property vec "ln"
4917 (tramp-message vec 5 "Finding a suitable `ln' command") 4919 (tramp-message vec 5 "Finding a suitable `ln' command")
4918 (tramp-find-executable vec "ln" (tramp-get-remote-path vec)))) 4920 (tramp-find-executable vec "ln" (tramp-get-remote-path vec))))
4919 4921
4920(defun tramp-get-remote-perl (vec) 4922(defun tramp-get-remote-perl (vec)
4921 (with-connection-property vec "perl" 4923 (with-tramp-connection-property vec "perl"
4922 (tramp-message vec 5 "Finding a suitable `perl' command") 4924 (tramp-message vec 5 "Finding a suitable `perl' command")
4923 (let ((result 4925 (let ((result
4924 (or (tramp-find-executable vec "perl5" (tramp-get-remote-path vec)) 4926 (or (tramp-find-executable vec "perl5" (tramp-get-remote-path vec))
@@ -4926,16 +4928,16 @@ This is used internally by `tramp-file-mode-from-int'."
4926 vec "perl" (tramp-get-remote-path vec))))) 4928 vec "perl" (tramp-get-remote-path vec)))))
4927 ;; We must check also for some Perl modules. 4929 ;; We must check also for some Perl modules.
4928 (when result 4930 (when result
4929 (with-connection-property vec "perl-file-spec" 4931 (with-tramp-connection-property vec "perl-file-spec"
4930 (tramp-send-command-and-check 4932 (tramp-send-command-and-check
4931 vec (format "%s -e 'use File::Spec;'" result))) 4933 vec (format "%s -e 'use File::Spec;'" result)))
4932 (with-connection-property vec "perl-cwd-realpath" 4934 (with-tramp-connection-property vec "perl-cwd-realpath"
4933 (tramp-send-command-and-check 4935 (tramp-send-command-and-check
4934 vec (format "%s -e 'use Cwd \"realpath\";'" result)))) 4936 vec (format "%s -e 'use Cwd \"realpath\";'" result))))
4935 result))) 4937 result)))
4936 4938
4937(defun tramp-get-remote-stat (vec) 4939(defun tramp-get-remote-stat (vec)
4938 (with-connection-property vec "stat" 4940 (with-tramp-connection-property vec "stat"
4939 (tramp-message vec 5 "Finding a suitable `stat' command") 4941 (tramp-message vec 5 "Finding a suitable `stat' command")
4940 (let ((result (tramp-find-executable 4942 (let ((result (tramp-find-executable
4941 vec "stat" (tramp-get-remote-path vec))) 4943 vec "stat" (tramp-get-remote-path vec)))
@@ -4953,7 +4955,7 @@ This is used internally by `tramp-file-mode-from-int'."
4953 result))) 4955 result)))
4954 4956
4955(defun tramp-get-remote-readlink (vec) 4957(defun tramp-get-remote-readlink (vec)
4956 (with-connection-property vec "readlink" 4958 (with-tramp-connection-property vec "readlink"
4957 (tramp-message vec 5 "Finding a suitable `readlink' command") 4959 (tramp-message vec 5 "Finding a suitable `readlink' command")
4958 (let ((result (tramp-find-executable 4960 (let ((result (tramp-find-executable
4959 vec "readlink" (tramp-get-remote-path vec)))) 4961 vec "readlink" (tramp-get-remote-path vec))))
@@ -4963,12 +4965,12 @@ This is used internally by `tramp-file-mode-from-int'."
4963 result)))) 4965 result))))
4964 4966
4965(defun tramp-get-remote-trash (vec) 4967(defun tramp-get-remote-trash (vec)
4966 (with-connection-property vec "trash" 4968 (with-tramp-connection-property vec "trash"
4967 (tramp-message vec 5 "Finding a suitable `trash' command") 4969 (tramp-message vec 5 "Finding a suitable `trash' command")
4968 (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))) 4970 (tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
4969 4971
4970(defun tramp-get-remote-id (vec) 4972(defun tramp-get-remote-id (vec)
4971 (with-connection-property vec "id" 4973 (with-tramp-connection-property vec "id"
4972 (tramp-message vec 5 "Finding POSIX `id' command") 4974 (tramp-message vec 5 "Finding POSIX `id' command")
4973 (or 4975 (or
4974 (catch 'id-found 4976 (catch 'id-found
@@ -4982,7 +4984,7 @@ This is used internally by `tramp-file-mode-from-int'."
4982 (tramp-error vec 'file-error "Couldn't find a POSIX `id' command")))) 4984 (tramp-error vec 'file-error "Couldn't find a POSIX `id' command"))))
4983 4985
4984(defun tramp-get-remote-uid (vec id-format) 4986(defun tramp-get-remote-uid (vec id-format)
4985 (with-connection-property vec (format "uid-%s" id-format) 4987 (with-tramp-connection-property vec (format "uid-%s" id-format)
4986 (let ((res (tramp-send-command-and-read 4988 (let ((res (tramp-send-command-and-read
4987 vec 4989 vec
4988 (format "%s -u%s %s" 4990 (format "%s -u%s %s"
@@ -4994,7 +4996,7 @@ This is used internally by `tramp-file-mode-from-int'."
4994 (if (and (equal id-format 'integer) (not (integerp res))) -1 res)))) 4996 (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
4995 4997
4996(defun tramp-get-remote-gid (vec id-format) 4998(defun tramp-get-remote-gid (vec id-format)
4997 (with-connection-property vec (format "gid-%s" id-format) 4999 (with-tramp-connection-property vec (format "gid-%s" id-format)
4998 (let ((res (tramp-send-command-and-read 5000 (let ((res (tramp-send-command-and-read
4999 vec 5001 vec
5000 (format "%s -g%s %s" 5002 (format "%s -g%s %s"
@@ -5020,7 +5022,7 @@ the length of the file to be compressed.
5020If no corresponding command is found, nil is returned." 5022If no corresponding command is found, nil is returned."
5021 (when (and (integerp tramp-inline-compress-start-size) 5023 (when (and (integerp tramp-inline-compress-start-size)
5022 (> size tramp-inline-compress-start-size)) 5024 (> size tramp-inline-compress-start-size))
5023 (with-connection-property (tramp-get-connection-process vec) prop 5025 (with-tramp-connection-property (tramp-get-connection-process vec) prop
5024 (tramp-find-inline-compress vec) 5026 (tramp-find-inline-compress vec)
5025 (tramp-get-connection-property 5027 (tramp-get-connection-property
5026 (tramp-get-connection-process vec) prop nil)))) 5028 (tramp-get-connection-process vec) prop nil))))
@@ -5041,7 +5043,8 @@ function cell is returned to be applied on a buffer."
5041 ;; no inline coding is found. 5043 ;; no inline coding is found.
5042 (ignore-errors 5044 (ignore-errors
5043 (let ((coding 5045 (let ((coding
5044 (with-connection-property (tramp-get-connection-process vec) prop 5046 (with-tramp-connection-property
5047 (tramp-get-connection-process vec) prop
5045 (tramp-find-inline-encoding vec) 5048 (tramp-find-inline-encoding vec)
5046 (tramp-get-connection-property 5049 (tramp-get-connection-property
5047 (tramp-get-connection-process vec) prop nil))) 5050 (tramp-get-connection-process vec) prop nil)))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index f1d54b6fd3c..567f8f2969a 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -355,7 +355,7 @@ pass to the OPERATION."
355 (let ((t1 (tramp-tramp-file-p dirname)) 355 (let ((t1 (tramp-tramp-file-p dirname))
356 (t2 (tramp-tramp-file-p newname))) 356 (t2 (tramp-tramp-file-p newname)))
357 (with-parsed-tramp-file-name (if t1 dirname newname) nil 357 (with-parsed-tramp-file-name (if t1 dirname newname) nil
358 (tramp-with-progress-reporter 358 (with-tramp-progress-reporter
359 v 0 (format "Copying %s to %s" dirname newname) 359 v 0 (format "Copying %s to %s" dirname newname)
360 (cond 360 (cond
361 ;; We must use a local temporary directory. 361 ;; We must use a local temporary directory.
@@ -491,7 +491,7 @@ KEEP-DATE has no effect in case NEWNAME resides on an SMB server.
491PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored." 491PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
492 (setq filename (expand-file-name filename) 492 (setq filename (expand-file-name filename)
493 newname (expand-file-name newname)) 493 newname (expand-file-name newname))
494 (tramp-with-progress-reporter 494 (with-tramp-progress-reporter
495 (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) 495 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
496 0 (format "Copying %s to %s" filename newname) 496 0 (format "Copying %s to %s" filename newname)
497 497
@@ -642,7 +642,8 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
642 (unless id-format (setq id-format 'integer)) 642 (unless id-format (setq id-format 'integer))
643 (ignore-errors 643 (ignore-errors
644 (with-parsed-tramp-file-name filename nil 644 (with-parsed-tramp-file-name filename nil
645 (with-file-property v localname (format "file-attributes-%s" id-format) 645 (with-tramp-file-property
646 v localname (format "file-attributes-%s" id-format)
646 (if (and (tramp-smb-get-share v) (tramp-smb-get-stat-capability v)) 647 (if (and (tramp-smb-get-share v) (tramp-smb-get-stat-capability v))
647 (tramp-smb-do-file-attributes-with-stat v id-format) 648 (tramp-smb-do-file-attributes-with-stat v id-format)
648 ;; Reading just the filename entry via "dir localname" is not 649 ;; Reading just the filename entry via "dir localname" is not
@@ -753,7 +754,7 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
753 v 'file-error 754 v 'file-error
754 "Cannot make local copy of non-existing file `%s'" filename)) 755 "Cannot make local copy of non-existing file `%s'" filename))
755 (let ((tmpfile (tramp-compat-make-temp-file filename))) 756 (let ((tmpfile (tramp-compat-make-temp-file filename)))
756 (tramp-with-progress-reporter 757 (with-tramp-progress-reporter
757 v 3 (format "Fetching %s to tmp file %s" filename tmpfile) 758 v 3 (format "Fetching %s to tmp file %s" filename tmpfile)
758 (unless (tramp-smb-send-command 759 (unless (tramp-smb-send-command
759 v (format "get \"%s\" \"%s\"" 760 v (format "get \"%s\" \"%s\""
@@ -771,7 +772,7 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
771 (all-completions 772 (all-completions
772 filename 773 filename
773 (with-parsed-tramp-file-name directory nil 774 (with-parsed-tramp-file-name directory nil
774 (with-file-property v localname "file-name-all-completions" 775 (with-tramp-file-property v localname "file-name-all-completions"
775 (save-match-data 776 (save-match-data
776 (let ((entries (tramp-smb-get-file-entries directory))) 777 (let ((entries (tramp-smb-get-file-entries directory)))
777 (mapcar 778 (mapcar
@@ -1119,7 +1120,7 @@ target of the symlink differ."
1119 (if (file-remote-p filename) filename newname)) 1120 (if (file-remote-p filename) filename newname))
1120 'file-already-exists newname)) 1121 'file-already-exists newname))
1121 1122
1122 (tramp-with-progress-reporter 1123 (with-tramp-progress-reporter
1123 (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) 1124 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
1124 0 (format "Renaming %s to %s" filename newname) 1125 0 (format "Renaming %s to %s" filename newname)
1125 1126
@@ -1253,7 +1254,7 @@ errors for shares like \"C$/\", which are common in Microsoft Windows."
1253 (list start end tmpfile append 'no-message lockname confirm) 1254 (list start end tmpfile append 'no-message lockname confirm)
1254 (list start end tmpfile append 'no-message lockname))) 1255 (list start end tmpfile append 'no-message lockname)))
1255 1256
1256 (tramp-with-progress-reporter 1257 (with-tramp-progress-reporter
1257 v 3 (format "Moving tmp file %s to %s" tmpfile filename) 1258 v 3 (format "Moving tmp file %s to %s" tmpfile filename)
1258 (unwind-protect 1259 (unwind-protect
1259 (unless (tramp-smb-send-command 1260 (unless (tramp-smb-send-command
@@ -1312,7 +1313,7 @@ Either the shares are listed, or the `dir' command is executed.
1312Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)." 1313Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
1313 (with-parsed-tramp-file-name (file-name-as-directory directory) nil 1314 (with-parsed-tramp-file-name (file-name-as-directory directory) nil
1314 (setq localname (or localname "/")) 1315 (setq localname (or localname "/"))
1315 (with-file-property v localname "file-entries" 1316 (with-tramp-file-property v localname "file-entries"
1316 (with-current-buffer (tramp-get-connection-buffer v) 1317 (with-current-buffer (tramp-get-connection-buffer v)
1317 (let* ((share (tramp-smb-get-share v)) 1318 (let* ((share (tramp-smb-get-share v))
1318 (cache (tramp-get-connection-property v "share-cache" nil)) 1319 (cache (tramp-get-connection-property v "share-cache" nil))
@@ -1497,7 +1498,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
1497 ;; When we are not logged in yet, we return nil. 1498 ;; When we are not logged in yet, we return nil.
1498 (if (let ((p (tramp-get-connection-process vec))) 1499 (if (let ((p (tramp-get-connection-process vec)))
1499 (and p (processp p) (memq (process-status p) '(run open)))) 1500 (and p (processp p) (memq (process-status p) '(run open))))
1500 (with-connection-property 1501 (with-tramp-connection-property
1501 (tramp-get-connection-process vec) "cifs-capabilities" 1502 (tramp-get-connection-process vec) "cifs-capabilities"
1502 (save-match-data 1503 (save-match-data
1503 (when (tramp-smb-send-command vec "posix") 1504 (when (tramp-smb-send-command vec "posix")
@@ -1515,7 +1516,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
1515 ;; When we are not logged in yet, we return nil. 1516 ;; When we are not logged in yet, we return nil.
1516 (if (let ((p (tramp-get-connection-process vec))) 1517 (if (let ((p (tramp-get-connection-process vec)))
1517 (and p (processp p) (memq (process-status p) '(run open)))) 1518 (and p (processp p) (memq (process-status p) '(run open))))
1518 (with-connection-property 1519 (with-tramp-connection-property
1519 (tramp-get-connection-process vec) "stat-capability" 1520 (tramp-get-connection-process vec) "stat-capability"
1520 (tramp-smb-send-command vec "stat .")))) 1521 (tramp-smb-send-command vec "stat ."))))
1521 1522
@@ -1625,7 +1626,7 @@ If ARGUMENT is non-nil, use it as argument for
1625 (setq args (append args (list argument)))) 1626 (setq args (append args (list argument))))
1626 1627
1627 ;; OK, let's go. 1628 ;; OK, let's go.
1628 (tramp-with-progress-reporter 1629 (with-tramp-progress-reporter
1629 vec 3 1630 vec 3
1630 (format "Opening connection for //%s%s/%s" 1631 (format "Opening connection for //%s%s/%s"
1631 (if (not (zerop (length user))) (concat user "@") "") 1632 (if (not (zerop (length user))) (concat user "@") "")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b1532eb2ae4..874c0aa7fef 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1353,8 +1353,7 @@ ARGS to actually emit the message (if applicable)."
1353 "tramp-debug-message" 1353 "tramp-debug-message"
1354 "tramp-error" 1354 "tramp-error"
1355 "tramp-error-with-buffer" 1355 "tramp-error-with-buffer"
1356 "tramp-message" 1356 "tramp-message")
1357 "tramp-with-progress-reporter")
1358 t) 1357 t)
1359 "$") 1358 "$")
1360 fn))) 1359 fn)))
@@ -1498,7 +1497,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
1498 (when (string-match message (or (current-message) "")) 1497 (when (string-match message (or (current-message) ""))
1499 (tramp-compat-funcall 'progress-reporter-update reporter value)))) 1498 (tramp-compat-funcall 'progress-reporter-update reporter value))))
1500 1499
1501(defmacro tramp-with-progress-reporter (vec level message &rest body) 1500(defmacro with-tramp-progress-reporter (vec level message &rest body)
1502 "Executes BODY, spinning a progress reporter with MESSAGE. 1501 "Executes BODY, spinning a progress reporter with MESSAGE.
1503If LEVEL does not fit for visible messages, or if this is a 1502If LEVEL does not fit for visible messages, or if this is a
1504nested call of the macro, there are only traces without a visible 1503nested call of the macro, there are only traces without a visible
@@ -1527,7 +1526,42 @@ progress reporter."
1527 (tramp-message ,vec ,level "%s...done" ,message)))) 1526 (tramp-message ,vec ,level "%s...done" ,message))))
1528 1527
1529(tramp-compat-font-lock-add-keywords 1528(tramp-compat-font-lock-add-keywords
1530 'emacs-lisp-mode '("\\<tramp-with-progress-reporter\\>")) 1529 'emacs-lisp-mode '("\\<with-tramp-progress-reporter\\>"))
1530
1531(defmacro with-tramp-file-property (vec file property &rest body)
1532 "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
1533FILE must be a local file name on a connection identified via VEC."
1534 `(if (file-name-absolute-p ,file)
1535 (let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
1536 (when (eq value 'undef)
1537 ;; We cannot pass @body as parameter to
1538 ;; `tramp-set-file-property' because it mangles our
1539 ;; debug messages.
1540 (setq value (progn ,@body))
1541 (tramp-set-file-property ,vec ,file ,property value))
1542 value)
1543 ,@body))
1544
1545(put 'with-tramp-file-property 'lisp-indent-function 3)
1546(put 'with-tramp-file-property 'edebug-form-spec t)
1547(tramp-compat-font-lock-add-keywords
1548 'emacs-lisp-mode '("\\<with-tramp-file-property\\>"))
1549
1550(defmacro with-tramp-connection-property (key property &rest body)
1551 "Check in Tramp for property PROPERTY, otherwise executes BODY and set."
1552 `(let ((value (tramp-get-connection-property ,key ,property 'undef)))
1553 (when (eq value 'undef)
1554 ;; We cannot pass ,@body as parameter to
1555 ;; `tramp-set-connection-property' because it mangles our debug
1556 ;; messages.
1557 (setq value (progn ,@body))
1558 (tramp-set-connection-property ,key ,property value))
1559 value))
1560
1561(put 'with-tramp-connection-property 'lisp-indent-function 2)
1562(put 'with-tramp-connection-property 'edebug-form-spec t)
1563(tramp-compat-font-lock-add-keywords
1564 'emacs-lisp-mode '("\\<with-tramp-connection-property\\>"))
1531 1565
1532(defalias 'tramp-drop-volume-letter 1566(defalias 'tramp-drop-volume-letter
1533 (if (memq system-type '(cygwin windows-nt)) 1567 (if (memq system-type '(cygwin windows-nt))
@@ -2860,7 +2894,7 @@ User is always nil."
2860 (setq filename (expand-file-name filename)) 2894 (setq filename (expand-file-name filename))
2861 (let (result local-copy remote-copy) 2895 (let (result local-copy remote-copy)
2862 (with-parsed-tramp-file-name filename nil 2896 (with-parsed-tramp-file-name filename nil
2863 (tramp-with-progress-reporter 2897 (with-tramp-progress-reporter
2864 v 3 (format "Inserting `%s'" filename) 2898 v 3 (format "Inserting `%s'" filename)
2865 (unwind-protect 2899 (unwind-protect
2866 (if (not (file-exists-p filename)) 2900 (if (not (file-exists-p filename))
@@ -2983,7 +3017,7 @@ User is always nil."
2983 (if (not (file-exists-p file)) 3017 (if (not (file-exists-p file))
2984 nil 3018 nil
2985 (let ((tramp-message-show-message (not nomessage))) 3019 (let ((tramp-message-show-message (not nomessage)))
2986 (tramp-with-progress-reporter v 0 (format "Loading %s" file) 3020 (with-tramp-progress-reporter v 0 (format "Loading %s" file)
2987 (let ((local-copy (file-local-copy file))) 3021 (let ((local-copy (file-local-copy file)))
2988 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. 3022 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
2989 (unwind-protect 3023 (unwind-protect
@@ -3127,7 +3161,7 @@ beginning of local filename are not substituted."
3127 "Send the login name." 3161 "Send the login name."
3128 (when (not (stringp tramp-current-user)) 3162 (when (not (stringp tramp-current-user))
3129 (setq tramp-current-user 3163 (setq tramp-current-user
3130 (with-connection-property vec "login-as" 3164 (with-tramp-connection-property vec "login-as"
3131 (save-window-excursion 3165 (save-window-excursion
3132 (let ((enable-recursive-minibuffers t)) 3166 (let ((enable-recursive-minibuffers t))
3133 (pop-to-buffer (tramp-get-connection-buffer vec)) 3167 (pop-to-buffer (tramp-get-connection-buffer vec))
@@ -3417,13 +3451,13 @@ the remote host use line-endings as defined in the variable
3417(defun tramp-get-inode (vec) 3451(defun tramp-get-inode (vec)
3418 "Returns the virtual inode number. 3452 "Returns the virtual inode number.
3419If it doesn't exist, generate a new one." 3453If it doesn't exist, generate a new one."
3420 (with-file-property vec (tramp-file-name-localname vec) "inode" 3454 (with-tramp-file-property vec (tramp-file-name-localname vec) "inode"
3421 (setq tramp-inodes (1+ tramp-inodes)))) 3455 (setq tramp-inodes (1+ tramp-inodes))))
3422 3456
3423(defun tramp-get-device (vec) 3457(defun tramp-get-device (vec)
3424 "Returns the virtual device number. 3458 "Returns the virtual device number.
3425If it doesn't exist, generate a new one." 3459If it doesn't exist, generate a new one."
3426 (with-connection-property (tramp-get-connection-process vec) "device" 3460 (with-tramp-connection-property (tramp-get-connection-process vec) "device"
3427 (cons -1 (setq tramp-devices (1+ tramp-devices))))) 3461 (cons -1 (setq tramp-devices (1+ tramp-devices)))))
3428 3462
3429(defun tramp-equal-remote (file1 file2) 3463(defun tramp-equal-remote (file1 file2)
@@ -3545,7 +3579,7 @@ would yield `t'. On the other hand, the following check results in nil:
3545 3579
3546(defun tramp-get-remote-tmpdir (vec) 3580(defun tramp-get-remote-tmpdir (vec)
3547 "Return directory for temporary files on the remote host identified by VEC." 3581 "Return directory for temporary files on the remote host identified by VEC."
3548 (with-connection-property vec "tmpdir" 3582 (with-tramp-connection-property vec "tmpdir"
3549 (let ((dir (tramp-make-tramp-file-name 3583 (let ((dir (tramp-make-tramp-file-name
3550 (tramp-file-name-method vec) 3584 (tramp-file-name-method vec)
3551 (tramp-file-name-user vec) 3585 (tramp-file-name-user vec)
@@ -3833,7 +3867,6 @@ Only works for Bourne-like shells."
3833;; * In Emacs 21, `insert-directory' shows total number of bytes used 3867;; * In Emacs 21, `insert-directory' shows total number of bytes used
3834;; by the files in that directory. Add this here. 3868;; by the files in that directory. Add this here.
3835;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman) 3869;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
3836;; * Make ffap.el grok Tramp filenames. (Eli Tziperman)
3837;; * abbreviate-file-name 3870;; * abbreviate-file-name
3838;; * Better error checking. At least whenever we see something 3871;; * Better error checking. At least whenever we see something
3839;; strange when doing zerop, we should kill the process and start 3872;; strange when doing zerop, we should kill the process and start
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 2d0a8e3d23d..331884691f4 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -31,7 +31,7 @@
31;; should be changed only there. 31;; should be changed only there.
32 32
33;;;###tramp-autoload 33;;;###tramp-autoload
34(defconst tramp-version "2.2.6" 34(defconst tramp-version "2.2.7-pre"
35 "This version of Tramp.") 35 "This version of Tramp.")
36 36
37;;;###tramp-autoload 37;;;###tramp-autoload
@@ -44,7 +44,7 @@
44 (= emacs-major-version 21) 44 (= emacs-major-version 21)
45 (>= emacs-minor-version 4))) 45 (>= emacs-minor-version 4)))
46 "ok" 46 "ok"
47 (format "Tramp 2.2.6 is not fit for %s" 47 (format "Tramp 2.2.7-pre is not fit for %s"
48 (when (string-match "^.*$" (emacs-version)) 48 (when (string-match "^.*$" (emacs-version))
49 (match-string 0 (emacs-version))))))) 49 (match-string 0 (emacs-version)))))))
50 (unless (string-match "\\`ok\\'" x) (error "%s" x))) 50 (unless (string-match "\\`ok\\'" x) (error "%s" x)))