summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2010-08-05 10:15:22 +0200
committerMichael Albinus <michael.albinus@gmx.de>2010-08-05 10:15:22 +0200
commit39e1bf0b6aeee1ea39361cfb95c723abf569a7e3 (patch)
treed14ef771e6a4466dce4daee419b865c4d52d898c
parent3d15fe78eb01bbdae62666b2b7d8c13da92ac05f (diff)
downloademacs-39e1bf0b6aeee1ea39361cfb95c723abf569a7e3.tar.gz
* net/tramp.el (tramp-handle-dired-uncache): Flush directory
cache, not only file cache. (tramp-process-sentinel): New defun. (tramp-handle-start-file-process): Use it, in order to invalidate file caches.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/net/tramp.el21
2 files changed, 23 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c6476ca1df5..27e66a84f86 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-05 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp.el (tramp-handle-dired-uncache): Flush directory
+ cache, not only file cache.
+ (tramp-process-sentinel): New defun.
+ (tramp-handle-start-file-process): Use it, in order to invalidate
+ file caches.
+
2010-08-03 Leo <sdl.web@gmail.com>
* server.el (server-start): Simplify loop.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index aca0238e5b6..65713580b1b 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4234,7 +4234,7 @@ This is like `dired-recursive-delete-directory' for Tramp files."
;; DIR-P is valid for XEmacs only.
(with-parsed-tramp-file-name
(if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil
- (tramp-flush-file-property v localname)))
+ (tramp-flush-directory-property v localname)))
;; Pacify byte-compiler. The function is needed on XEmacs only. I'm
;; not sure at all that this is the right way to do it, but let's hope
@@ -4503,6 +4503,14 @@ beginning of local filename are not substituted."
(with-parsed-tramp-file-name default-directory nil
(tramp-find-executable v command (tramp-get-remote-path v) t)))
+(defun tramp-process-sentinel (proc event)
+ "Flush file caches."
+ (unless (memq (process-status proc) '(run open))
+ (with-current-buffer (process-buffer proc)
+ (with-parsed-tramp-file-name default-directory nil
+ (tramp-message v 5 "Sentinel called: `%s' `%s'" proc event)
+ (tramp-flush-directory-property v "")))))
+
;; We use BUFFER also as connection buffer during setup. Because of
;; this, its original contents must be saved, and restored once
;; connection has been setup.
@@ -4546,11 +4554,12 @@ beginning of local filename are not substituted."
(unless (process-get (tramp-get-connection-process v) 'remote-tty)
(tramp-error
v 'file-error "pty association is not supported for `%s'" name)))
- ;; Set query flag for this process.
- (tramp-set-process-query-on-exit-flag
- (tramp-get-connection-process v) t)
- ;; Return process.
- (tramp-get-connection-process v))
+ (let ((p (tramp-get-connection-process v)))
+ ;; Set sentinel and query flag for this process.
+ (set-process-sentinel p 'tramp-process-sentinel)
+ (tramp-set-process-query-on-exit-flag p t)
+ ;; Return process.
+ p))
;; Save exit.
(with-current-buffer (tramp-get-connection-buffer v)
(if (string-match tramp-temp-buffer-name (buffer-name))