Mercurial > emacs
comparison lisp/net/tramp-smb.el @ 103531:74d482177a44
* net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
handler for `dired-uncache'.
(tramp-smb-handle-file-local-copy): Cleanup in case of error.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Mon, 22 Jun 2009 21:08:29 +0000 |
parents | 3b92ee10ce02 |
children | 99d98ed749b9 |
comparison
equal
deleted
inserted
replaced
103530:bd92ac143136 | 103531:74d482177a44 |
---|---|
137 (directory-file-name . tramp-handle-directory-file-name) | 137 (directory-file-name . tramp-handle-directory-file-name) |
138 (directory-files . tramp-smb-handle-directory-files) | 138 (directory-files . tramp-smb-handle-directory-files) |
139 (directory-files-and-attributes . tramp-smb-handle-directory-files-and-attributes) | 139 (directory-files-and-attributes . tramp-smb-handle-directory-files-and-attributes) |
140 (dired-call-process . ignore) | 140 (dired-call-process . ignore) |
141 (dired-compress-file . ignore) | 141 (dired-compress-file . ignore) |
142 ;; `dired-uncache' performed by default handler | 142 (dired-uncache . tramp-handle-dired-uncache) |
143 ;; `expand-file-name' not necessary because we cannot expand "~/" | 143 ;; `expand-file-name' not necessary because we cannot expand "~/" |
144 (file-accessible-directory-p . tramp-smb-handle-file-directory-p) | 144 (file-accessible-directory-p . tramp-smb-handle-file-directory-p) |
145 (file-attributes . tramp-smb-handle-file-attributes) | 145 (file-attributes . tramp-smb-handle-file-attributes) |
146 (file-directory-p . tramp-smb-handle-file-directory-p) | 146 (file-directory-p . tramp-smb-handle-file-directory-p) |
147 (file-executable-p . tramp-smb-handle-file-exists-p) | 147 (file-executable-p . tramp-smb-handle-file-exists-p) |
373 (not (null (file-attributes filename)))) | 373 (not (null (file-attributes filename)))) |
374 | 374 |
375 (defun tramp-smb-handle-file-local-copy (filename) | 375 (defun tramp-smb-handle-file-local-copy (filename) |
376 "Like `file-local-copy' for Tramp files." | 376 "Like `file-local-copy' for Tramp files." |
377 (with-parsed-tramp-file-name filename nil | 377 (with-parsed-tramp-file-name filename nil |
378 (unless (file-exists-p filename) | |
379 (tramp-error | |
380 v 'file-error | |
381 "Cannot make local copy of non-existing file `%s'" filename)) | |
378 (let ((file (tramp-smb-get-localname localname t)) | 382 (let ((file (tramp-smb-get-localname localname t)) |
379 (tmpfile (tramp-compat-make-temp-file filename))) | 383 (tmpfile (tramp-compat-make-temp-file filename))) |
380 (unless (file-exists-p filename) | |
381 (tramp-error | |
382 v 'file-error | |
383 "Cannot make local copy of non-existing file `%s'" filename)) | |
384 (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile) | 384 (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile) |
385 (if (tramp-smb-send-command v (format "get \"%s\" %s" file tmpfile)) | 385 (if (tramp-smb-send-command v (format "get \"%s\" %s" file tmpfile)) |
386 (tramp-message | 386 (tramp-message |
387 v 4 "Fetching %s to tmp file %s...done" filename tmpfile) | 387 v 4 "Fetching %s to tmp file %s...done" filename tmpfile) |
388 ;; Oops, an error. We shall cleanup. | |
389 (delete-file tmpfile) | |
388 (tramp-error | 390 (tramp-error |
389 v 'file-error | 391 v 'file-error |
390 "Cannot make local copy of file `%s'" filename)) | 392 "Cannot make local copy of file `%s'" filename)) |
391 tmpfile))) | 393 tmpfile))) |
392 | 394 |