Quantcast

tramp does not see directory changes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

tramp does not see directory changes

Hans Halvorson-2
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
directory.

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
existence.

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?

Thanks,
Hans


_______________________________________________
Tramp-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/tramp-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tramp does not see directory changes

Michael Albinus
Hans Halvorson <[hidden email]> writes:

> 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?

Exactly. And, IIRC, ange-ftp behaves also like this.

With dired, you can always press "g" (revert-buffer) in order to reread
the directory contents in the related dired buffer.

> Thanks,
> Hans

Best regards, Michael.


_______________________________________________
Tramp-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/tramp-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tramp does not see directory changes

Piotr Romanus
In reply to this post by Hans Halvorson-2
Michael Albinus writes:
> Exactly. And, IIRC, ange-ftp behaves also like this.

> With dired, you can always press "g" (revert-buffer) in order to reread
> the directory contents in the related dired buffer.Michael Albinus

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?

Thanks,

Piotr




_______________________________________________
Tramp-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/tramp-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tramp does not see directory changes

Michael Albinus
Piotr Romanus <[hidden email]> writes:

> 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?

> Thanks,
>
> Piotr

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)))))
 
  (add-hook 'before-revert-hook 'tramp-flush-file-function)
  (add-hook 'kill-buffer-hook 'tramp-flush-file-function)
  (add-hook 'tramp-cache-unload-hook
   '(lambda ()
      (remove-hook 'before-revert-hook
   'tramp-flush-file-function)
      (remove-hook 'kill-buffer-hook
   'tramp-flush-file-function)))
 
--- 162,184 ----
  ;; They could have been changed outside Tramp.
  (defun tramp-flush-file-function ()
    "Flush all Tramp cache properties from buffer-file-name."
!   (let ((bfn (if (stringp (buffer-file-name))
! (buffer-file-name)
!       default-directory)))
!     (when (tramp-tramp-file-p bfn)
        (let* ((v (tramp-dissect-file-name bfn))
      (localname (tramp-file-name-localname v)))
  (tramp-flush-file-property v localname)))))
 
  (add-hook 'before-revert-hook 'tramp-flush-file-function)
+ (add-hook 'eshell-pre-command-hook 'tramp-flush-file-function)
  (add-hook 'kill-buffer-hook 'tramp-flush-file-function)
  (add-hook 'tramp-cache-unload-hook
   '(lambda ()
      (remove-hook 'before-revert-hook
   'tramp-flush-file-function)
+     (remove-hook 'eshell-pre-command-hook
+  'tramp-flush-file-function)
      (remove-hook 'kill-buffer-hook
   'tramp-flush-file-function)))
 



_______________________________________________
Tramp-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/tramp-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tramp does not see directory changes

Piotr-6

On Tue, 2007-10-30 at 14:11 +0100, Michael Albinus wrote:
>
> The appended patch shall cure it. Could you, please, test it?


It works. Thanks. One more question: uname -a in the remote dir in
eshell returns empty string. I would presume that this is eshell problem
rather than tramp problem. Am I correct?


Piotr




_______________________________________________
Tramp-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/tramp-devel
Loading...