"Thomas S. Chin" <[EMAIL PROTECTED]> writes:

> I admit that I am not intimately familiar with what options are at
> your disposal, but if it is possible to detect multiple consecutive
> tab keystrokes (e.g. 3), it could then refresh the cache entry for
> that particular directory.  If not, another explicit key binding that
> is consistent with other emacs bindings signifying "refresh" would be
> a second option.  Another option might be to have the cache layer
> refresh on every X accesses, so if a user were to hit tab X times, he
> is guaranteed to have it reload from the remote host.  You can make X
> a configurable parameter and default it to never reload if that is
> your preferred behavior.  A user like me that is willing to sacrifice
> some performance could change this setting to 1 if I always want it to
> reload, or some other number.
>
> Tell me what you think about these options.

Tramp cannot handle keystrokes, because it is not involved in this. And
it wouldn't be a good idea if Tramp would do its own handling there,
given the number of different packages which provide file name
completion on their own way (f.e. pcomplete.el, ido.el, icicles.el).

Tramp can only do some actions inside file-name-all-completions, which
is called by all these packages. The following patch flushes the
directory cache, if the last file name completion happened more than
10" before. This shall be sufficient, I hope.

Could you, please, test the appended patch whether it is acceptable?

> thom

Best regards, Michael.

*** /media/disk/tramp/lisp/tramp.el.~1~	Mon Nov 12 19:38:36 2007
--- /media/disk/tramp/lisp/tramp.el	Thu Nov 15 17:14:35 2007
***************
*** 2807,2812 ****
--- 2807,2821 ----
    "Like `file-name-all-completions' for Tramp files."
    (unless (save-match-data (string-match "/" filename))
      (with-parsed-tramp-file-name (expand-file-name directory) nil
+       ;; Flush the directory cache after 10".  There could be changed
+       ;; directory contents.
+       (when (> (tramp-time-diff
+ 		(current-time)
+ 		(tramp-get-file-property
+ 		 v localname "last-completion" '(0 0 0)))
+ 	       10)
+ 	(tramp-flush-file-property v localname))
+ 
        (all-completions
         filename
         (mapcar
***************
*** 2838,2843 ****
--- 2847,2854 ----
  		      (point) (tramp-compat-line-end-position))
  		     result)))
  
+ 	   (tramp-set-file-property
+ 	    v localname "last-completion" (current-time))
  	   result)))))))
  
  ;; The following isn't needed for Emacs 20 but for 19.34?
_______________________________________________
Tramp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/tramp-devel

Reply via email to