aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2008-12-04 20:42:29 +0000
committerMichael Albinus2008-12-04 20:42:29 +0000
commit063e5167c85d40df6c49ae35d7c74285eb2612c8 (patch)
tree381d27124bf03dc6317d2bd0b449a015ff5c2dcc
parentfcb61bee01d80856f959a93c9158254256dc7e49 (diff)
downloademacs-063e5167c85d40df6c49ae35d7c74285eb2612c8.tar.gz
emacs-063e5167c85d40df6c49ae35d7c74285eb2612c8.zip
* net/tramp-cache.el (tramp-dump-connection-properties): Polish
the check, whether to dump the data.
-rw-r--r--lisp/net/tramp-cache.el68
1 files changed, 34 insertions, 34 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 466cd7f5a41..f0ba15548f9 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -251,40 +251,40 @@ KEY identifies the connection, it is either a process or a vector."
251(defun tramp-dump-connection-properties () 251(defun tramp-dump-connection-properties ()
252 "Write persistent connection properties into file `tramp-persistency-file-name'." 252 "Write persistent connection properties into file `tramp-persistency-file-name'."
253 ;; We shouldn't fail, otherwise (X)Emacs might not be able to be closed. 253 ;; We shouldn't fail, otherwise (X)Emacs might not be able to be closed.
254 (when tramp-cache-data-changed 254 (condition-case nil
255 (condition-case nil 255 (when (and (hash-table-p tramp-cache-data)
256 (when (and (hash-table-p tramp-cache-data) 256 (not (zerop (hash-table-count tramp-cache-data)))
257 (not (zerop (hash-table-count tramp-cache-data))) 257 tramp-cache-data-changed
258 (stringp tramp-persistency-file-name)) 258 (stringp tramp-persistency-file-name))
259 (let ((cache (copy-hash-table tramp-cache-data))) 259 (let ((cache (copy-hash-table tramp-cache-data)))
260 ;; Remove temporary data. 260 ;; Remove temporary data.
261 (maphash 261 (maphash
262 '(lambda (key value) 262 '(lambda (key value)
263 (if (and (vectorp key) (not (tramp-file-name-localname key))) 263 (if (and (vectorp key) (not (tramp-file-name-localname key)))
264 (progn 264 (progn
265 (remhash "process-name" value) 265 (remhash "process-name" value)
266 (remhash "process-buffer" value)) 266 (remhash "process-buffer" value))
267 (remhash key cache))) 267 (remhash key cache)))
268 cache) 268 cache)
269 ;; Dump it. 269 ;; Dump it.
270 (with-temp-buffer 270 (with-temp-buffer
271 (insert 271 (insert
272 ";; -*- emacs-lisp -*-" 272 ";; -*- emacs-lisp -*-"
273 ;; `time-stamp-string' might not exist in all (X)Emacs flavors. 273 ;; `time-stamp-string' might not exist in all (X)Emacs flavors.
274 (condition-case nil 274 (condition-case nil
275 (progn 275 (progn
276 (format 276 (format
277 " <%s %s>\n" 277 " <%s %s>\n"
278 (time-stamp-string "%02y/%02m/%02d %02H:%02M:%02S") 278 (time-stamp-string "%02y/%02m/%02d %02H:%02M:%02S")
279 tramp-persistency-file-name)) 279 tramp-persistency-file-name))
280 (error "\n")) 280 (error "\n"))
281 ";; Tramp connection history. Don't change this file.\n" 281 ";; Tramp connection history. Don't change this file.\n"
282 ";; You can delete it, forcing Tramp to reapply the checks.\n\n" 282 ";; You can delete it, forcing Tramp to reapply the checks.\n\n"
283 (with-output-to-string 283 (with-output-to-string
284 (pp (read (format "(%s)" (tramp-cache-print cache)))))) 284 (pp (read (format "(%s)" (tramp-cache-print cache))))))
285 (write-region 285 (write-region
286 (point-min) (point-max) tramp-persistency-file-name)))) 286 (point-min) (point-max) tramp-persistency-file-name))))
287 (error nil)))) 287 (error nil)))
288 288
289(add-hook 'kill-emacs-hook 'tramp-dump-connection-properties) 289(add-hook 'kill-emacs-hook 'tramp-dump-connection-properties)
290(add-hook 'tramp-cache-unload-hook 290(add-hook 'tramp-cache-unload-hook