diff lisp/net/tramp-sh.el @ 110702:4e901a2d3669

* files.el (remote-file-name-inhibit-cache): New defcustom. * time.el (display-time-file-nonempty-p): Use `remote-file-name-inhibit-cache'. * net/tramp.el (tramp-completion-reread-directory-timeout): Fix docstring. * net/tramp-cache.el (tramp-cache-inhibit-cache): Remove. (tramp-get-file-property): Replace `tramp-cache-inhibit-cache' by `remote-file-name-inhibit-cache'. Check also for an integer value. Add/increase counter when `tramp-verbose' >= 10. (tramp-set-file-property): Add/increase counter when `tramp-verbose' >= 10. * net/tramp-cmds.el (tramp-cleanup-all-connections) (tramp-cleanup-all-buffers): Set tramp-autoload cookie. (tramp-bug): Set tramp-autoload cookie. Report all interned tramp-* variables. Report also `remote-file-name-inhibit-cache'. (tramp-reporter-dump-variable): Fix docstring. Mask non-7bit characters only in strings. * net/tramp-compat.el (remote-file-name-inhibit-cache): Define due to backward compatibility. * net/tramp-sh.el (tramp-handle-verify-visited-file-modtime) (tramp-handle-file-name-all-completions) (tramp-handle-vc-registered): Use `remote-file-name-inhibit-cache'. (tramp-open-connection-setup-interactive-shell): Call `tramp-cleanup-connection' directly.
author Michael Albinus <michael.albinus@gmx.de>
date Sat, 02 Oct 2010 15:21:43 +0200
parents 932697ced7aa
children d6e88106c5b8
line wrap: on
line diff
--- a/lisp/net/tramp-sh.el	Sat Oct 02 14:34:02 2010 +0200
+++ b/lisp/net/tramp-sh.el	Sat Oct 02 15:21:43 2010 +0200
@@ -1366,8 +1366,8 @@
 	      (not (tramp-file-name-handler 'file-remote-p f nil 'connected)))
 	  t
 	(with-parsed-tramp-file-name f nil
-	  (tramp-flush-file-property v localname)
-	  (let* ((attr (file-attributes f))
+	  (let* ((remote-file-name-inhibit-cache t)
+		 (attr (file-attributes f))
 		 (modtime (nth 5 attr))
 		 (mt (visited-file-modtime)))
 
@@ -1770,46 +1770,39 @@
        (mapcar
 	'list
         (or
-         ;; Try cache first
-         (and
-          ;; Ignore if expired
-          (or (not (integerp tramp-completion-reread-directory-timeout))
-              (<= (tramp-time-diff
-                   (current-time)
-                   (tramp-get-file-property
-                    v localname "last-completion" '(0 0 0)))
-                  tramp-completion-reread-directory-timeout))
-
-          ;; Try cache entries for filename, filename with last
-          ;; character removed, filename with last two characters
-          ;; removed, ..., and finally the empty string - all
-          ;; concatenated to the local directory name
-
-          ;; This is inefficient for very long filenames, pity
-          ;; `reduce' is not available...
-          (car
-           (apply
-            'append
-            (mapcar
-             (lambda (x)
-               (let ((cache-hit
-                      (tramp-get-file-property
-                       v
-                       (concat localname (substring filename 0 x))
-                       "file-name-all-completions"
-                       nil)))
-                 (when cache-hit (list cache-hit))))
-             (tramp-compat-number-sequence (length filename) 0 -1)))))
+	 ;; Try cache entries for filename, filename with last
+	 ;; character removed, filename with last two characters
+	 ;; removed, ..., and finally the empty string - all
+	 ;; concatenated to the local directory name.
+         (let ((remote-file-name-inhibit-cache
+		(or remote-file-name-inhibit-cache
+		    tramp-completion-reread-directory-timeout)))
+
+	   ;; This is inefficient for very long filenames, pity
+	   ;; `reduce' is not available...
+	   (car
+	    (apply
+	     'append
+	     (mapcar
+	      (lambda (x)
+		(let ((cache-hit
+		       (tramp-get-file-property
+			v
+			(concat localname (substring filename 0 x))
+			"file-name-all-completions"
+			nil)))
+		  (when cache-hit (list cache-hit))))
+	      (tramp-compat-number-sequence (length filename) 0 -1)))))
 
          ;; Cache expired or no matching cache entry found so we need
-         ;; to perform a remote operation
+         ;; to perform a remote operation.
          (let (result)
            ;; Get a list of directories and files, including reliably
            ;; tagging the directories with a trailing '/'.  Because I
            ;; rock.  --daniel@danann.net
 
            ;; Changed to perform `cd' in the same remote op and only
-           ;; get entries starting with `filename'. Capture any `cd'
+           ;; get entries starting with `filename'.  Capture any `cd'
            ;; error messages.  Ensure any `cd' and `echo' aliases are
            ;; ignored.
            (tramp-send-command
@@ -1904,9 +1897,6 @@
 		    v (concat localname entry) "file-exists-p" t))
 		 result)
 
-           (tramp-set-file-property
-            v localname "last-completion" (current-time))
-
            ;; Store result in the cache
            (tramp-set-file-property
             v (concat localname filename)
@@ -3669,7 +3659,7 @@
 	;; There could be new files, created by the vc backend.  We
 	;; cannot reuse the old cache entries, therefore.
 	(let (tramp-vc-registered-file-names
-	      (tramp-cache-inhibit-cache (current-time))
+	      (remote-file-name-inhibit-cache (current-time))
 	      (file-name-handler-alist
 	       `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
 
@@ -4085,7 +4075,7 @@
 	;; Keep the debug buffer.
 	(rename-buffer
 	 (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
-	(tramp-compat-funcall 'tramp-cleanup-connection vec)
+	(tramp-cleanup-connection vec)
 	(if (= (point-min) (point-max))
 	    (kill-buffer nil)
 	  (rename-buffer (tramp-debug-buffer-name vec) 'unique))