I have noted that if Tramp is used to visit a file in a remote
directory, and if that remote directory is altered (e.g. a new file is
created), then Tramp is not aware of the changed state of the
For example, suppose I visit file "foo", and then I create (outside of
emacs) another file "bar" (in the same remote directory as "foo"). If
I then attempt to use autocompletion, Tramp/Emacs will not
autocomplete the filename "bar" -- it seems not to know of its
I suppose that Tramp caches the directory contents (for speed), and
that it would slow things down to check for new files. Was that the
rationale behind the current setup?
> This creates problems with eshell: I copied a file from my local host
> to a remote host. Subsequent ls would show the changes :(. I also
> tried deleting a file on the remote with the same results.
> Is there anyway to foce tramp to refresh directory or disable caching
> when in eshell?
The appended patch shall cure it. Could you, please, test it?
Best regards, Michael.
*** /media/disk/tramp/lisp/tramp-cache.el Fri Sep 28 16:34:14 2007
--- /home/albinus/src/tramp/lisp/tramp-cache.el Tue Oct 30 14:03:58 2007
*** 162,179 ****
;; They could have been changed outside Tramp.
(defun tramp-flush-file-function ()
"Flush all Tramp cache properties from buffer-file-name."
! (let ((bfn (buffer-file-name)))
! (when (and (stringp bfn) (tramp-tramp-file-p bfn))
(let* ((v (tramp-dissect-file-name bfn))
(localname (tramp-file-name-localname v)))
(tramp-flush-file-property v localname)))))