aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-06-02 00:48:23 -0300
committerStefan Monnier2011-06-02 00:48:23 -0300
commit7d5200893a8cc980744bb4c65355df5a936388bb (patch)
tree936f771391b10855e544e0f3a178ac25ecaf1b4e
parenta1c2400f272533e9f5cefa8ce59732c355950fd8 (diff)
downloademacs-7d5200893a8cc980744bb4c65355df5a936388bb.tar.gz
emacs-7d5200893a8cc980744bb4c65355df5a936388bb.zip
* lisp/net/tramp.el (tramp-with-progress-reporter): Rename from
with-progress-reporter. Use `declare'. * lisp/net/tramp-smb.el: * lisp/net/tramp-sh.el: * lisp/net/tramp-gvfs.el: Update all uses.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/net/tramp-gvfs.el6
-rw-r--r--lisp/net/tramp-sh.el28
-rw-r--r--lisp/net/tramp-smb.el10
-rw-r--r--lisp/net/tramp.el11
5 files changed, 36 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 92b125dd1b0..1f82735806a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-06-02 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * net/tramp.el (tramp-with-progress-reporter): Rename from
4 with-progress-reporter. Use `declare'.
5 * net/tramp-smb.el:
6 * net/tramp-sh.el:
7 * net/tramp-gvfs.el: Update all uses.
8
12011-06-02 Jay Belanger <jay.p.belanger@gmail.com> 92011-06-02 Jay Belanger <jay.p.belanger@gmail.com>
2 10
3 * calc/calc.el (calc-kill-stack-buffer): Make sure that the trail 11 * calc/calc.el (calc-kill-stack-buffer): Make sure that the trail
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index b3278dc312d..269b47be20c 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -541,7 +541,7 @@ is no information where to trace the message.")
541 "Like `copy-file' for Tramp files." 541 "Like `copy-file' for Tramp files."
542 (with-parsed-tramp-file-name 542 (with-parsed-tramp-file-name
543 (if (tramp-tramp-file-p filename) filename newname) nil 543 (if (tramp-tramp-file-p filename) filename newname) nil
544 (with-progress-reporter 544 (tramp-with-progress-reporter
545 v 0 (format "Copying %s to %s" filename newname) 545 v 0 (format "Copying %s to %s" filename newname)
546 (condition-case err 546 (condition-case err
547 (let ((args 547 (let ((args
@@ -745,7 +745,7 @@ is no information where to trace the message.")
745 "Like `rename-file' for Tramp files." 745 "Like `rename-file' for Tramp files."
746 (with-parsed-tramp-file-name 746 (with-parsed-tramp-file-name
747 (if (tramp-tramp-file-p filename) filename newname) nil 747 (if (tramp-tramp-file-p filename) filename newname) nil
748 (with-progress-reporter 748 (tramp-with-progress-reporter
749 v 0 (format "Renaming %s to %s" filename newname) 749 v 0 (format "Renaming %s to %s" filename newname)
750 (condition-case err 750 (condition-case err
751 (rename-file 751 (rename-file
@@ -1203,7 +1203,7 @@ connection if a previous connection has died for some reason."
1203 (tramp-gvfs-object-path 1203 (tramp-gvfs-object-path
1204 (tramp-make-tramp-file-name method user host "")))) 1204 (tramp-make-tramp-file-name method user host ""))))
1205 1205
1206 (with-progress-reporter 1206 (tramp-with-progress-reporter
1207 vec 3 1207 vec 3
1208 (if (zerop (length user)) 1208 (if (zerop (length user))
1209 (format "Opening connection for %s using %s" host method) 1209 (format "Opening connection for %s using %s" host method)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index cc404baef06..a25877abe90 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1945,7 +1945,7 @@ file names."
1945 (tramp-error 1945 (tramp-error
1946 v 'file-already-exists "File %s already exists" newname)) 1946 v 'file-already-exists "File %s already exists" newname))
1947 1947
1948 (with-progress-reporter 1948 (tramp-with-progress-reporter
1949 v 0 (format "%s %s to %s" 1949 v 0 (format "%s %s to %s"
1950 (if (eq op 'copy) "Copying" "Renaming") 1950 (if (eq op 'copy) "Copying" "Renaming")
1951 filename newname) 1951 filename newname)
@@ -2454,7 +2454,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
2454 nil) 2454 nil)
2455 ((and suffix (nth 2 suffix)) 2455 ((and suffix (nth 2 suffix))
2456 ;; We found an uncompression rule. 2456 ;; We found an uncompression rule.
2457 (with-progress-reporter v 0 (format "Uncompressing %s" file) 2457 (tramp-with-progress-reporter
2458 v 0 (format "Uncompressing %s" file)
2458 (when (tramp-send-command-and-check 2459 (when (tramp-send-command-and-check
2459 v (concat (nth 2 suffix) " " 2460 v (concat (nth 2 suffix) " "
2460 (tramp-shell-quote-argument localname))) 2461 (tramp-shell-quote-argument localname)))
@@ -2465,7 +2466,7 @@ This is like `dired-recursive-delete-directory' for Tramp files."
2465 (t 2466 (t
2466 ;; We don't recognize the file as compressed, so compress it. 2467 ;; We don't recognize the file as compressed, so compress it.
2467 ;; Try gzip. 2468 ;; Try gzip.
2468 (with-progress-reporter v 0 (format "Compressing %s" file) 2469 (tramp-with-progress-reporter v 0 (format "Compressing %s" file)
2469 (when (tramp-send-command-and-check 2470 (when (tramp-send-command-and-check
2470 v (concat "gzip -f " 2471 v (concat "gzip -f "
2471 (tramp-shell-quote-argument localname))) 2472 (tramp-shell-quote-argument localname)))
@@ -2948,7 +2949,7 @@ the result will be a local, non-Tramp, filename."
2948 ;; Use inline encoding for file transfer. 2949 ;; Use inline encoding for file transfer.
2949 (rem-enc 2950 (rem-enc
2950 (save-excursion 2951 (save-excursion
2951 (with-progress-reporter 2952 (tramp-with-progress-reporter
2952 v 3 (format "Encoding remote file %s" filename) 2953 v 3 (format "Encoding remote file %s" filename)
2953 (tramp-barf-unless-okay 2954 (tramp-barf-unless-okay
2954 v (format rem-enc (tramp-shell-quote-argument localname)) 2955 v (format rem-enc (tramp-shell-quote-argument localname))
@@ -2962,7 +2963,7 @@ the result will be a local, non-Tramp, filename."
2962 (with-temp-buffer 2963 (with-temp-buffer
2963 (set-buffer-multibyte nil) 2964 (set-buffer-multibyte nil)
2964 (insert-buffer-substring (tramp-get-buffer v)) 2965 (insert-buffer-substring (tramp-get-buffer v))
2965 (with-progress-reporter 2966 (tramp-with-progress-reporter
2966 v 3 (format "Decoding remote file %s with function %s" 2967 v 3 (format "Decoding remote file %s with function %s"
2967 filename loc-dec) 2968 filename loc-dec)
2968 (funcall loc-dec (point-min) (point-max)) 2969 (funcall loc-dec (point-min) (point-max))
@@ -2980,7 +2981,7 @@ the result will be a local, non-Tramp, filename."
2980 (let (file-name-handler-alist 2981 (let (file-name-handler-alist
2981 (coding-system-for-write 'binary)) 2982 (coding-system-for-write 'binary))
2982 (write-region (point-min) (point-max) tmpfile2)) 2983 (write-region (point-min) (point-max) tmpfile2))
2983 (with-progress-reporter 2984 (tramp-with-progress-reporter
2984 v 3 (format "Decoding remote file %s with command %s" 2985 v 3 (format "Decoding remote file %s with command %s"
2985 filename loc-dec) 2986 filename loc-dec)
2986 (unwind-protect 2987 (unwind-protect
@@ -3205,7 +3206,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3205 (set-buffer-multibyte nil) 3206 (set-buffer-multibyte nil)
3206 ;; Use encoding function or command. 3207 ;; Use encoding function or command.
3207 (if (functionp loc-enc) 3208 (if (functionp loc-enc)
3208 (with-progress-reporter 3209 (tramp-with-progress-reporter
3209 v 3 (format "Encoding region using function `%s'" 3210 v 3 (format "Encoding region using function `%s'"
3210 loc-enc) 3211 loc-enc)
3211 (let ((coding-system-for-read 'binary)) 3212 (let ((coding-system-for-read 'binary))
@@ -3223,7 +3224,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3223 (tramp-compat-temporary-file-directory))) 3224 (tramp-compat-temporary-file-directory)))
3224 (funcall loc-enc (point-min) (point-max)))) 3225 (funcall loc-enc (point-min) (point-max))))
3225 3226
3226 (with-progress-reporter 3227 (tramp-with-progress-reporter
3227 v 3 (format "Encoding region using command `%s'" 3228 v 3 (format "Encoding region using command `%s'"
3228 loc-enc) 3229 loc-enc)
3229 (unless (zerop (tramp-call-local-coding-command 3230 (unless (zerop (tramp-call-local-coding-command
@@ -3237,7 +3238,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3237 ;; Send buffer into remote decoding command which 3238 ;; Send buffer into remote decoding command which
3238 ;; writes to remote file. Because this happens on 3239 ;; writes to remote file. Because this happens on
3239 ;; the remote host, we cannot use the function. 3240 ;; the remote host, we cannot use the function.
3240 (with-progress-reporter 3241 (tramp-with-progress-reporter
3241 v 3 3242 v 3
3242 (format "Decoding region into remote file %s" filename) 3243 (format "Decoding region into remote file %s" filename)
3243 (goto-char (point-max)) 3244 (goto-char (point-max))
@@ -3337,7 +3338,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
3337 "Like `vc-registered' for Tramp files." 3338 "Like `vc-registered' for Tramp files."
3338 (tramp-compat-with-temp-message "" 3339 (tramp-compat-with-temp-message ""
3339 (with-parsed-tramp-file-name file nil 3340 (with-parsed-tramp-file-name file nil
3340 (with-progress-reporter 3341 (tramp-with-progress-reporter
3341 v 3 (format "Checking `vc-registered' for %s" file) 3342 v 3 (format "Checking `vc-registered' for %s" file)
3342 3343
3343 ;; There could be new files, created by the vc backend. We 3344 ;; There could be new files, created by the vc backend. We
@@ -3431,7 +3432,7 @@ Only send the definition if it has not already been done."
3431 (let* ((p (tramp-get-connection-process vec)) 3432 (let* ((p (tramp-get-connection-process vec))
3432 (scripts (tramp-get-connection-property p "scripts" nil))) 3433 (scripts (tramp-get-connection-property p "scripts" nil)))
3433 (unless (member name scripts) 3434 (unless (member name scripts)
3434 (with-progress-reporter vec 5 (format "Sending script `%s'" name) 3435 (tramp-with-progress-reporter vec 5 (format "Sending script `%s'" name)
3435 ;; The script could contain a call of Perl. This is masked with `%s'. 3436 ;; The script could contain a call of Perl. This is masked with `%s'.
3436 (tramp-barf-unless-okay 3437 (tramp-barf-unless-okay
3437 vec 3438 vec
@@ -3595,7 +3596,8 @@ file exists and nonzero exit status otherwise."
3595 3596
3596(defun tramp-open-shell (vec shell) 3597(defun tramp-open-shell (vec shell)
3597 "Opens shell SHELL." 3598 "Opens shell SHELL."
3598 (with-progress-reporter vec 5 (format "Opening remote shell `%s'" shell) 3599 (tramp-with-progress-reporter
3600 vec 5 (format "Opening remote shell `%s'" shell)
3599 ;; Find arguments for this shell. 3601 ;; Find arguments for this shell.
3600 (let ((tramp-end-of-output tramp-initial-end-of-output) 3602 (let ((tramp-end-of-output tramp-initial-end-of-output)
3601 (alist tramp-sh-extra-args) 3603 (alist tramp-sh-extra-args)
@@ -4247,7 +4249,7 @@ connection if a previous connection has died for some reason."
4247 ;; We call `tramp-get-buffer' in order to get a debug buffer for 4249 ;; We call `tramp-get-buffer' in order to get a debug buffer for
4248 ;; messages from the beginning. 4250 ;; messages from the beginning.
4249 (tramp-get-buffer vec) 4251 (tramp-get-buffer vec)
4250 (with-progress-reporter 4252 (tramp-with-progress-reporter
4251 vec 3 4253 vec 3
4252 (if (zerop (length (tramp-file-name-user vec))) 4254 (if (zerop (length (tramp-file-name-user vec)))
4253 (format "Opening connection for %s using %s" 4255 (format "Opening connection for %s using %s"
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 5a62b71bda1..a43e99c1206 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -342,7 +342,7 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server.
342PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored." 342PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
343 (setq filename (expand-file-name filename) 343 (setq filename (expand-file-name filename)
344 newname (expand-file-name newname)) 344 newname (expand-file-name newname))
345 (with-progress-reporter 345 (tramp-with-progress-reporter
346 (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) 346 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
347 0 (format "Copying %s to %s" filename newname) 347 0 (format "Copying %s to %s" filename newname)
348 348
@@ -600,7 +600,7 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
600 v 'file-error 600 v 'file-error
601 "Cannot make local copy of non-existing file `%s'" filename)) 601 "Cannot make local copy of non-existing file `%s'" filename))
602 (let ((tmpfile (tramp-compat-make-temp-file filename))) 602 (let ((tmpfile (tramp-compat-make-temp-file filename)))
603 (with-progress-reporter 603 (tramp-with-progress-reporter
604 v 3 (format "Fetching %s to tmp file %s" filename tmpfile) 604 v 3 (format "Fetching %s to tmp file %s" filename tmpfile)
605 (unless (tramp-smb-send-command 605 (unless (tramp-smb-send-command
606 v (format "get \"%s\" \"%s\"" 606 v (format "get \"%s\" \"%s\""
@@ -837,7 +837,7 @@ target of the symlink differ."
837 "Like `rename-file' for Tramp files." 837 "Like `rename-file' for Tramp files."
838 (setq filename (expand-file-name filename) 838 (setq filename (expand-file-name filename)
839 newname (expand-file-name newname)) 839 newname (expand-file-name newname))
840 (with-progress-reporter 840 (tramp-with-progress-reporter
841 (tramp-dissect-file-name (if (file-remote-p filename) filename newname)) 841 (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
842 0 (format "Renaming %s to %s" filename newname) 842 0 (format "Renaming %s to %s" filename newname)
843 843
@@ -926,7 +926,7 @@ errors for shares like \"C$/\", which are common in Microsoft Windows."
926 (list start end tmpfile append 'no-message lockname confirm) 926 (list start end tmpfile append 'no-message lockname confirm)
927 (list start end tmpfile append 'no-message lockname))) 927 (list start end tmpfile append 'no-message lockname)))
928 928
929 (with-progress-reporter 929 (tramp-with-progress-reporter
930 v 3 (format "Moving tmp file %s to %s" tmpfile filename) 930 v 3 (format "Moving tmp file %s to %s" tmpfile filename)
931 (unwind-protect 931 (unwind-protect
932 (unless (tramp-smb-send-command 932 (unless (tramp-smb-send-command
@@ -1289,7 +1289,7 @@ connection if a previous connection has died for some reason."
1289 (setq args (append args (list "-s" tramp-smb-conf)))) 1289 (setq args (append args (list "-s" tramp-smb-conf))))
1290 1290
1291 ;; OK, let's go. 1291 ;; OK, let's go.
1292 (with-progress-reporter 1292 (tramp-with-progress-reporter
1293 vec 3 1293 vec 3
1294 (format "Opening connection for //%s%s/%s" 1294 (format "Opening connection for //%s%s/%s"
1295 (if (not (zerop (length user))) (concat user "@") "") 1295 (if (not (zerop (length user))) (concat user "@") "")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 537ccf6da6a..178f057a66c 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1452,11 +1452,12 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
1452 (when (string-match message (or (current-message) "")) 1452 (when (string-match message (or (current-message) ""))
1453 (tramp-compat-funcall 'progress-reporter-update reporter value)))) 1453 (tramp-compat-funcall 'progress-reporter-update reporter value))))
1454 1454
1455(defmacro with-progress-reporter (vec level message &rest body) 1455(defmacro tramp-with-progress-reporter (vec level message &rest body)
1456 "Executes BODY, spinning a progress reporter with MESSAGE. 1456 "Executes BODY, spinning a progress reporter with MESSAGE.
1457If LEVEL does not fit for visible messages, or if this is a 1457If LEVEL does not fit for visible messages, or if this is a
1458nested call of the macro, there are only traces without a visible 1458nested call of the macro, there are only traces without a visible
1459progress reporter." 1459progress reporter."
1460 (declare (indent 3) (debug t))
1460 `(let (pr tm) 1461 `(let (pr tm)
1461 (tramp-message ,vec ,level "%s..." ,message) 1462 (tramp-message ,vec ,level "%s..." ,message)
1462 ;; We start a pulsing progress reporter after 3 seconds. Feature 1463 ;; We start a pulsing progress reporter after 3 seconds. Feature
@@ -1479,10 +1480,8 @@ progress reporter."
1479 (if tm (tramp-compat-funcall 'cancel-timer tm)) 1480 (if tm (tramp-compat-funcall 'cancel-timer tm))
1480 (tramp-message ,vec ,level "%s...done" ,message)))) 1481 (tramp-message ,vec ,level "%s...done" ,message))))
1481 1482
1482(put 'with-progress-reporter 'lisp-indent-function 3)
1483(put 'with-progress-reporter 'edebug-form-spec t)
1484(tramp-compat-font-lock-add-keywords 1483(tramp-compat-font-lock-add-keywords
1485 'emacs-lisp-mode '("\\<with-progress-reporter\\>")) 1484 'emacs-lisp-mode '("\\<tramp-with-progress-reporter\\>"))
1486 1485
1487(eval-and-compile ;; Silence compiler. 1486(eval-and-compile ;; Silence compiler.
1488 (if (memq system-type '(cygwin windows-nt)) 1487 (if (memq system-type '(cygwin windows-nt))
@@ -2881,7 +2880,7 @@ User is always nil."
2881 ;; useful for "rsync". 2880 ;; useful for "rsync".
2882 (setq tramp-temp-buffer-file-name local-copy)) 2881 (setq tramp-temp-buffer-file-name local-copy))
2883 2882
2884 (with-progress-reporter 2883 (tramp-with-progress-reporter
2885 v 3 (format "Inserting local temp file `%s'" local-copy) 2884 v 3 (format "Inserting local temp file `%s'" local-copy)
2886 ;; We must ensure that `file-coding-system-alist' 2885 ;; We must ensure that `file-coding-system-alist'
2887 ;; matches `local-copy'. 2886 ;; matches `local-copy'.
@@ -2932,7 +2931,7 @@ User is always nil."
2932 (if (not (file-exists-p file)) 2931 (if (not (file-exists-p file))
2933 nil 2932 nil
2934 (let ((tramp-message-show-message (not nomessage))) 2933 (let ((tramp-message-show-message (not nomessage)))
2935 (with-progress-reporter v 0 (format "Loading %s" file) 2934 (tramp-with-progress-reporter v 0 (format "Loading %s" file)
2936 (let ((local-copy (file-local-copy file))) 2935 (let ((local-copy (file-local-copy file)))
2937 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. 2936 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
2938 (unwind-protect 2937 (unwind-protect