Commit 1d51f99c authored by Michael Albinus's avatar Michael Albinus

* 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.
parent bf05ed1f
2012-10-09 Michael Albinus <michael.albinus@gmx.de>
* 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.
2012-10-09 Glenn Morris <rgm@gnu.org>
* w32-fns.el (set-message-beep):
......
......@@ -138,27 +138,6 @@ Returns VALUE."
(set var (1+ val))))
value))
;;;###tramp-autoload
(defmacro with-file-property (vec file property &rest body)
"Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
FILE must be a local file name on a connection identified via VEC."
`(if (file-name-absolute-p ,file)
(let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
(when (eq value 'undef)
;; We cannot pass @body as parameter to
;; `tramp-set-file-property' because it mangles our
;; debug messages.
(setq value (progn ,@body))
(tramp-set-file-property ,vec ,file ,property value))
value)
,@body))
;;;###tramp-autoload
(put 'with-file-property 'lisp-indent-function 3)
(put 'with-file-property 'edebug-form-spec t)
(tramp-compat-font-lock-add-keywords
'emacs-lisp-mode '("\\<with-file-property\\>"))
;;;###tramp-autoload
(defun tramp-flush-file-property (vec file)
"Remove all properties of FILE in the cache context of VEC."
......@@ -249,24 +228,6 @@ PROPERTY is set persistent when KEY is a vector."
(tramp-message key 7 "%s %s" property value)
value))
;;;###tramp-autoload
(defmacro with-connection-property (key property &rest body)
"Check in Tramp for property PROPERTY, otherwise executes BODY and set."
`(let ((value (tramp-get-connection-property ,key ,property 'undef)))
(when (eq value 'undef)
;; We cannot pass ,@body as parameter to
;; `tramp-set-connection-property' because it mangles our debug
;; messages.
(setq value (progn ,@body))
(tramp-set-connection-property ,key ,property value))
value))
;;;###tramp-autoload
(put 'with-connection-property 'lisp-indent-function 2)
(put 'with-connection-property 'edebug-form-spec t)
(tramp-compat-font-lock-add-keywords
'emacs-lisp-mode '("\\<with-connection-property\\>"))
;;;###tramp-autoload
(defun tramp-flush-connection-property (key)
"Remove all properties identified by KEY.
......
......@@ -537,7 +537,7 @@ is no information where to trace the message.")
"Like `copy-file' for Tramp files."
(with-parsed-tramp-file-name
(if (tramp-tramp-file-p filename) filename newname) nil
(tramp-with-progress-reporter
(with-tramp-progress-reporter
v 0 (format "Copying %s to %s" filename newname)
(condition-case err
(let ((args
......@@ -741,7 +741,7 @@ is no information where to trace the message.")
"Like `rename-file' for Tramp files."
(with-parsed-tramp-file-name
(if (tramp-tramp-file-p filename) filename newname) nil
(tramp-with-progress-reporter
(with-tramp-progress-reporter
v 0 (format "Renaming %s to %s" filename newname)
(condition-case err
(rename-file
......@@ -1056,7 +1056,7 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
(catch 'mounted
(dolist
(elt
(with-file-property vec "/" "list-mounts"
(with-tramp-file-property vec "/" "list-mounts"
(with-tramp-dbus-call-method vec t
:session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
tramp-gvfs-interface-mounttracker "listMounts"))
......@@ -1199,7 +1199,7 @@ connection if a previous connection has died for some reason."
(tramp-gvfs-object-path
(tramp-make-tramp-file-name method user host ""))))
(tramp-with-progress-reporter
(with-tramp-progress-reporter
vec 3
(if (zerop (length user))
(format "Opening connection for %s using %s" host method)
......
This diff is collapsed.
......@@ -355,7 +355,7 @@ pass to the OPERATION."
(let ((t1 (tramp-tramp-file-p dirname))
(t2 (tramp-tramp-file-p newname)))
(with-parsed-tramp-file-name (if t1 dirname newname) nil
(tramp-with-progress-reporter
(with-tramp-progress-reporter
v 0 (format "Copying %s to %s" dirname newname)
(cond
;; We must use a local temporary directory.
......@@ -491,7 +491,7 @@ KEEP-DATE has no effect in case NEWNAME resides on an SMB server.
PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
(setq filename (expand-file-name filename)
newname (expand-file-name newname))
(tramp-with-progress-reporter
(with-tramp-progress-reporter
(tramp-dissect-file-name (if (file-remote-p filename) filename newname))
0 (format "Copying %s to %s" filename newname)
......@@ -642,7 +642,8 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
(unless id-format (setq id-format 'integer))
(ignore-errors
(with-parsed-tramp-file-name filename nil
(with-file-property v localname (format "file-attributes-%s" id-format)
(with-tramp-file-property
v localname (format "file-attributes-%s" id-format)
(if (and (tramp-smb-get-share v) (tramp-smb-get-stat-capability v))
(tramp-smb-do-file-attributes-with-stat v id-format)
;; Reading just the filename entry via "dir localname" is not
......@@ -753,7 +754,7 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
v 'file-error
"Cannot make local copy of non-existing file `%s'" filename))
(let ((tmpfile (tramp-compat-make-temp-file filename)))
(tramp-with-progress-reporter
(with-tramp-progress-reporter
v 3 (format "Fetching %s to tmp file %s" filename tmpfile)
(unless (tramp-smb-send-command
v (format "get \"%s\" \"%s\""
......@@ -771,7 +772,7 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
(all-completions
filename
(with-parsed-tramp-file-name directory nil
(with-file-property v localname "file-name-all-completions"
(with-tramp-file-property v localname "file-name-all-completions"
(save-match-data
(let ((entries (tramp-smb-get-file-entries directory)))
(mapcar
......@@ -1119,7 +1120,7 @@ target of the symlink differ."
(if (file-remote-p filename) filename newname))
'file-already-exists newname))
(tramp-with-progress-reporter
(with-tramp-progress-reporter
(tramp-dissect-file-name (if (file-remote-p filename) filename newname))
0 (format "Renaming %s to %s" filename newname)
......@@ -1253,7 +1254,7 @@ errors for shares like \"C$/\", which are common in Microsoft Windows."
(list start end tmpfile append 'no-message lockname confirm)
(list start end tmpfile append 'no-message lockname)))
(tramp-with-progress-reporter
(with-tramp-progress-reporter
v 3 (format "Moving tmp file %s to %s" tmpfile filename)
(unwind-protect
(unless (tramp-smb-send-command
......@@ -1312,7 +1313,7 @@ Either the shares are listed, or the `dir' command is executed.
Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
(with-parsed-tramp-file-name (file-name-as-directory directory) nil
(setq localname (or localname "/"))
(with-file-property v localname "file-entries"
(with-tramp-file-property v localname "file-entries"
(with-current-buffer (tramp-get-connection-buffer v)
(let* ((share (tramp-smb-get-share v))
(cache (tramp-get-connection-property v "share-cache" nil))
......@@ -1497,7 +1498,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
;; When we are not logged in yet, we return nil.
(if (let ((p (tramp-get-connection-process vec)))
(and p (processp p) (memq (process-status p) '(run open))))
(with-connection-property
(with-tramp-connection-property
(tramp-get-connection-process vec) "cifs-capabilities"
(save-match-data
(when (tramp-smb-send-command vec "posix")
......@@ -1515,7 +1516,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
;; When we are not logged in yet, we return nil.
(if (let ((p (tramp-get-connection-process vec)))
(and p (processp p) (memq (process-status p) '(run open))))
(with-connection-property
(with-tramp-connection-property
(tramp-get-connection-process vec) "stat-capability"
(tramp-smb-send-command vec "stat ."))))
......@@ -1625,7 +1626,7 @@ If ARGUMENT is non-nil, use it as argument for
(setq args (append args (list argument))))
;; OK, let's go.
(tramp-with-progress-reporter
(with-tramp-progress-reporter
vec 3
(format "Opening connection for //%s%s/%s"
(if (not (zerop (length user))) (concat user "@") "")
......
......@@ -1353,8 +1353,7 @@ ARGS to actually emit the message (if applicable)."
"tramp-debug-message"
"tramp-error"
"tramp-error-with-buffer"
"tramp-message"
"tramp-with-progress-reporter")
"tramp-message")
t)
"$")
fn)))
......@@ -1498,7 +1497,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
(when (string-match message (or (current-message) ""))
(tramp-compat-funcall 'progress-reporter-update reporter value))))
(defmacro tramp-with-progress-reporter (vec level message &rest body)
(defmacro with-tramp-progress-reporter (vec level message &rest body)
"Executes BODY, spinning a progress reporter with MESSAGE.
If LEVEL does not fit for visible messages, or if this is a
nested call of the macro, there are only traces without a visible
......@@ -1527,7 +1526,42 @@ progress reporter."
(tramp-message ,vec ,level "%s...done" ,message))))
(tramp-compat-font-lock-add-keywords
'emacs-lisp-mode '("\\<tramp-with-progress-reporter\\>"))
'emacs-lisp-mode '("\\<with-tramp-progress-reporter\\>"))
(defmacro with-tramp-file-property (vec file property &rest body)
"Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
FILE must be a local file name on a connection identified via VEC."
`(if (file-name-absolute-p ,file)
(let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
(when (eq value 'undef)
;; We cannot pass @body as parameter to
;; `tramp-set-file-property' because it mangles our
;; debug messages.
(setq value (progn ,@body))
(tramp-set-file-property ,vec ,file ,property value))
value)
,@body))
(put 'with-tramp-file-property 'lisp-indent-function 3)
(put 'with-tramp-file-property 'edebug-form-spec t)
(tramp-compat-font-lock-add-keywords
'emacs-lisp-mode '("\\<with-tramp-file-property\\>"))
(defmacro with-tramp-connection-property (key property &rest body)
"Check in Tramp for property PROPERTY, otherwise executes BODY and set."
`(let ((value (tramp-get-connection-property ,key ,property 'undef)))
(when (eq value 'undef)
;; We cannot pass ,@body as parameter to
;; `tramp-set-connection-property' because it mangles our debug
;; messages.
(setq value (progn ,@body))
(tramp-set-connection-property ,key ,property value))
value))
(put 'with-tramp-connection-property 'lisp-indent-function 2)
(put 'with-tramp-connection-property 'edebug-form-spec t)
(tramp-compat-font-lock-add-keywords
'emacs-lisp-mode '("\\<with-tramp-connection-property\\>"))
(defalias 'tramp-drop-volume-letter
(if (memq system-type '(cygwin windows-nt))
......@@ -2860,7 +2894,7 @@ User is always nil."
(setq filename (expand-file-name filename))
(let (result local-copy remote-copy)
(with-parsed-tramp-file-name filename nil
(tramp-with-progress-reporter
(with-tramp-progress-reporter
v 3 (format "Inserting `%s'" filename)
(unwind-protect
(if (not (file-exists-p filename))
......@@ -2983,7 +3017,7 @@ User is always nil."
(if (not (file-exists-p file))
nil
(let ((tramp-message-show-message (not nomessage)))
(tramp-with-progress-reporter v 0 (format "Loading %s" file)
(with-tramp-progress-reporter v 0 (format "Loading %s" file)
(let ((local-copy (file-local-copy file)))
;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
(unwind-protect
......@@ -3127,7 +3161,7 @@ beginning of local filename are not substituted."
"Send the login name."
(when (not (stringp tramp-current-user))
(setq tramp-current-user
(with-connection-property vec "login-as"
(with-tramp-connection-property vec "login-as"
(save-window-excursion
(let ((enable-recursive-minibuffers t))
(pop-to-buffer (tramp-get-connection-buffer vec))
......@@ -3417,13 +3451,13 @@ the remote host use line-endings as defined in the variable
(defun tramp-get-inode (vec)
"Returns the virtual inode number.
If it doesn't exist, generate a new one."
(with-file-property vec (tramp-file-name-localname vec) "inode"
(with-tramp-file-property vec (tramp-file-name-localname vec) "inode"
(setq tramp-inodes (1+ tramp-inodes))))
(defun tramp-get-device (vec)
"Returns the virtual device number.
If it doesn't exist, generate a new one."
(with-connection-property (tramp-get-connection-process vec) "device"
(with-tramp-connection-property (tramp-get-connection-process vec) "device"
(cons -1 (setq tramp-devices (1+ tramp-devices)))))
(defun tramp-equal-remote (file1 file2)
......@@ -3545,7 +3579,7 @@ would yield `t'. On the other hand, the following check results in nil:
(defun tramp-get-remote-tmpdir (vec)
"Return directory for temporary files on the remote host identified by VEC."
(with-connection-property vec "tmpdir"
(with-tramp-connection-property vec "tmpdir"
(let ((dir (tramp-make-tramp-file-name
(tramp-file-name-method vec)
(tramp-file-name-user vec)
......@@ -3833,7 +3867,6 @@ Only works for Bourne-like shells."
;; * In Emacs 21, `insert-directory' shows total number of bytes used
;; by the files in that directory. Add this here.
;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
;; * Make ffap.el grok Tramp filenames. (Eli Tziperman)
;; * abbreviate-file-name
;; * Better error checking. At least whenever we see something
;; strange when doing zerop, we should kill the process and start
......
......@@ -31,7 +31,7 @@
;; should be changed only there.
;;;###tramp-autoload
(defconst tramp-version "2.2.6"
(defconst tramp-version "2.2.7-pre"
"This version of Tramp.")
;;;###tramp-autoload
......@@ -44,7 +44,7 @@
(= emacs-major-version 21)
(>= emacs-minor-version 4)))
"ok"
(format "Tramp 2.2.6 is not fit for %s"
(format "Tramp 2.2.7-pre is not fit for %s"
(when (string-match "^.*$" (emacs-version))
(match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment