aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2020-05-03 13:59:08 +0200
committerMichael Albinus2020-05-03 13:59:08 +0200
commita9432bd2cc01016b0fbdf3b8631070d95fc7600c (patch)
treebdf7e7b169cd248afbb693528886e1729d25ed1d
parent4be16866b959dd173e4016b8a16590093686e1f1 (diff)
downloademacs-a9432bd2cc01016b0fbdf3b8631070d95fc7600c.tar.gz
emacs-a9432bd2cc01016b0fbdf3b8631070d95fc7600c.zip
Improve Tramp debug messages
* lisp/net/tramp-cache.el (tramp-get-file-property) (tramp-get-connection-property): Improve debug messages. Suggested by Marc Herbert <marc.herbert@gmail.com>.
-rw-r--r--lisp/net/tramp-cache.el48
1 files changed, 29 insertions, 19 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 14a64382acb..02400f9deb5 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -139,23 +139,29 @@ Return DEFAULT if not set."
139 (tramp-run-real-handler #'directory-file-name (list file)) 139 (tramp-run-real-handler #'directory-file-name (list file))
140 (tramp-file-name-hop key) nil) 140 (tramp-file-name-hop key) nil)
141 (let* ((hash (tramp-get-hash-table key)) 141 (let* ((hash (tramp-get-hash-table key))
142 (value (when (hash-table-p hash) (gethash property hash)))) 142 (cached (and (hash-table-p hash) (gethash property hash)))
143 (if ;; We take the value only if there is any, and 143 (cached-at (and (consp cached) (format-time-string "%T" (car cached))))
144 ;; `remote-file-name-inhibit-cache' indicates that it is still 144 (value default)
145 ;; valid. Otherwise, DEFAULT is set. 145 use-cache)
146 (and (consp value) 146
147 (when ;; We take the value only if there is any, and
148 ;; `remote-file-name-inhibit-cache' indicates that it is
149 ;; still valid. Otherwise, DEFAULT is set.
150 (and (consp cached)
147 (or (null remote-file-name-inhibit-cache) 151 (or (null remote-file-name-inhibit-cache)
148 (and (integerp remote-file-name-inhibit-cache) 152 (and (integerp remote-file-name-inhibit-cache)
149 (time-less-p 153 (time-less-p
150 nil 154 nil
151 (time-add (car value) remote-file-name-inhibit-cache))) 155 (time-add (car cached) remote-file-name-inhibit-cache)))
152 (and (consp remote-file-name-inhibit-cache) 156 (and (consp remote-file-name-inhibit-cache)
153 (time-less-p 157 (time-less-p
154 remote-file-name-inhibit-cache (car value))))) 158 remote-file-name-inhibit-cache (car cached)))))
155 (setq value (cdr value)) 159 (setq value (cdr cached)
156 (setq value default)) 160 use-cache t))
157 161
158 (tramp-message key 8 "%s %s %s" file property value) 162 (tramp-message key 8 "%s %s %s; inhibit: %s; cache used: %s; cached at: %s"
163 file property value
164 remote-file-name-inhibit-cache use-cache cached-at)
159 (when (>= tramp-verbose 10) 165 (when (>= tramp-verbose 10)
160 (let* ((var (intern (concat "tramp-cache-get-count-" property))) 166 (let* ((var (intern (concat "tramp-cache-get-count-" property)))
161 (val (or (numberp (bound-and-true-p var)) 167 (val (or (numberp (bound-and-true-p var))
@@ -310,15 +316,19 @@ the connection, return DEFAULT."
310 (setf (tramp-file-name-localname key) nil 316 (setf (tramp-file-name-localname key) nil
311 (tramp-file-name-hop key) nil)) 317 (tramp-file-name-hop key) nil))
312 (let* ((hash (tramp-get-hash-table key)) 318 (let* ((hash (tramp-get-hash-table key))
313 (value 319 (cached (if (hash-table-p hash)
314 ;; If the key is an auxiliary process object, check whether 320 (gethash property hash tramp-cache-undefined)
315 ;; the process is still alive. 321 tramp-cache-undefined))
316 (if (and (processp key) (not (process-live-p key))) 322 (value default)
317 default 323 use-cache)
318 (if (hash-table-p hash) 324
319 (gethash property hash default) 325 (when (and (not (eq cached tramp-cache-undefined))
320 default)))) 326 ;; If the key is an auxiliary process object, check
321 (tramp-message key 7 "%s %s" property value) 327 ;; whether the process is still alive.
328 (not (and (processp key) (not (process-live-p key)))))
329 (setq value cached
330 use-cache t))
331 (tramp-message key 7 "%s %s; cache used: %s" property value use-cache)
322 value)) 332 value))
323 333
324;;;###tramp-autoload 334;;;###tramp-autoload