comparison lisp/net/tramp.el @ 102968:3f05108a52f1

* net/tramp.el (tramp-handle-dired-recursive-delete-directory): Fix an error in flushing cache data. (tramp-handle-process-file): Flush all file cache values for the connection, because the remote process could have changed them. Suggested by Stefan Monnier <monnier@iro.umontreal.ca>. Handle QUIT.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 14 Apr 2009 14:36:38 +0000
parents c9dbbc9ce416
children 078ccf3337b1
comparison
equal deleted inserted replaced
102967:ed58adc8f9aa 102968:3f05108a52f1
3466 ;; we try and delete two directories under Tramp :/ 3466 ;; we try and delete two directories under Tramp :/
3467 (defun tramp-handle-dired-recursive-delete-directory (filename) 3467 (defun tramp-handle-dired-recursive-delete-directory (filename)
3468 "Recursively delete the directory given. 3468 "Recursively delete the directory given.
3469 This is like `dired-recursive-delete-directory' for Tramp files." 3469 This is like `dired-recursive-delete-directory' for Tramp files."
3470 (with-parsed-tramp-file-name filename nil 3470 (with-parsed-tramp-file-name filename nil
3471 (tramp-flush-directory-property v filename) 3471 (tramp-flush-directory-property v localname)
3472 ;; Run a shell command 'rm -r <localname>' 3472 ;; Run a shell command 'rm -r <localname>'
3473 ;; Code shamelessly stolen for the dired implementation and, um, hacked :) 3473 ;; Code shamelessly stolen from the dired implementation and, um, hacked :)
3474 (unless (file-exists-p filename) 3474 (unless (file-exists-p filename)
3475 (tramp-error v 'file-error "No such directory: %s" filename)) 3475 (tramp-error v 'file-error "No such directory: %s" filename))
3476 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>) 3476 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>)
3477 (tramp-send-command 3477 (tramp-send-command
3478 v 3478 v
3894 (with-current-buffer (tramp-get-connection-buffer v) 3894 (with-current-buffer (tramp-get-connection-buffer v)
3895 (buffer-substring (point-min) (point-max))))) 3895 (buffer-substring (point-min) (point-max)))))
3896 (with-current-buffer outbuf 3896 (with-current-buffer outbuf
3897 (insert output-string))) 3897 (insert output-string)))
3898 (when display (display-buffer outbuf)))) 3898 (when display (display-buffer outbuf))))
3899 ;; When the user did interrupt, we should do it also. 3899 ;; When the user did interrupt, we should do it also. We use
3900 ;; return code -1 as marker.
3901 (quit
3902 (kill-buffer (tramp-get-connection-buffer v))
3903 (setq ret -1))
3904 ;; Handle errors.
3900 (error 3905 (error
3901 (kill-buffer (tramp-get-connection-buffer v)) 3906 (kill-buffer (tramp-get-connection-buffer v))
3902 (setq ret 1))) 3907 (setq ret 1)))
3903 3908
3904 ;; Check return code. 3909 ;; Check return code.
3905 (unless ret (setq ret (tramp-send-command-and-check v nil))) 3910 (unless ret (setq ret (tramp-send-command-and-check v nil)))
3906 ;; Provide error file. 3911 ;; Provide error file.
3907 (when tmpstderr (rename-file tmpstderr (cadr destination) t)) 3912 (when tmpstderr (rename-file tmpstderr (cadr destination) t))
3908 ;; Cleanup. 3913 ;; Cleanup. We remove all file cache values for the connection,
3914 ;; because the remote process could have changed them.
3909 (when tmpinput (delete-file tmpinput)) 3915 (when tmpinput (delete-file tmpinput))
3916 (tramp-flush-directory-property v "")
3910 ;; Return exit status. 3917 ;; Return exit status.
3911 ret))) 3918 (if (equal ret -1)
3919 (keyboard-quit)
3920 ret))))
3912 3921
3913 (defun tramp-local-call-process 3922 (defun tramp-local-call-process
3914 (program &optional infile destination display &rest args) 3923 (program &optional infile destination display &rest args)
3915 "Calls `call-process' on the local host. 3924 "Calls `call-process' on the local host.
3916 This is needed because for some Emacs flavors Tramp has 3925 This is needed because for some Emacs flavors Tramp has