emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/net tramp-cache.el


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp/net tramp-cache.el
Date: Mon, 01 Dec 2008 06:35:45 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       08/12/01 06:35:45

Modified files:
        lisp/net       : tramp-cache.el 

Log message:
        * net/tramp-cache.el (tramp-cache-data-changed): New defvar.
        (tramp-set-connection-property, tramp-flush-connection-property)
        (tramp-dump-connection-properties): Use it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp-cache.el?cvsroot=emacs&r1=1.15&r2=1.16

Patches:
Index: tramp-cache.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp-cache.el,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- tramp-cache.el      4 Sep 2008 11:45:13 -0000       1.15
+++ tramp-cache.el      1 Dec 2008 06:35:44 -0000       1.16
@@ -89,6 +89,9 @@
   :group 'tramp
   :type 'file)
 
+(defvar tramp-cache-data-changed nil
+  "Whether persistent cache data have been changed.")
+
 (defun tramp-get-file-property (vec file property default)
   "Get the PROPERTY of FILE from the cache context of VEC.
 Returns DEFAULT if not set."
@@ -195,6 +198,7 @@
                  (puthash key (make-hash-table :test 'equal)
                            tramp-cache-data))))
     (puthash property value hash)
+    (setq tramp-cache-data-changed t)
     ;; This function is called also during initialization of
     ;; tramp-cache.el.  `tramp-messageĀ“ is not defined yet at this
     ;; time, so we ignore the corresponding error.
@@ -211,6 +215,7 @@
   (when (vectorp key)
     (setq key (copy-sequence key))
     (aset key 3 nil))
+  (setq tramp-cache-data-changed t)
   (remhash key tramp-cache-data))
 
 (defun tramp-cache-print (table)
@@ -246,6 +251,7 @@
 (defun tramp-dump-connection-properties ()
   "Write persistent connection properties into file 
`tramp-persistency-file-name'."
   ;; We shouldn't fail, otherwise (X)Emacs might not be able to be closed.
+  (when tramp-cache-data-changed
   (condition-case nil
       (when (and (hash-table-p tramp-cache-data)
                 (not (zerop (hash-table-count tramp-cache-data)))
@@ -278,7 +284,7 @@
               (pp (read (format "(%s)" (tramp-cache-print cache))))))
            (write-region
             (point-min) (point-max) tramp-persistency-file-name))))
-    (error nil)))
+      (error nil))))
 
 (add-hook 'kill-emacs-hook 'tramp-dump-connection-properties)
 (add-hook 'tramp-cache-unload-hook
@@ -313,7 +319,8 @@
          (while (setq element (pop list))
            (setq key (pop element))
            (while (setq item (pop element))
-             (tramp-set-connection-property key (pop item) (car item))))))
+             (tramp-set-connection-property key (pop item) (car item)))))
+       (setq tramp-cache-data-changed nil))
     (file-error
      ;; Most likely because the file doesn't exist yet.  No message.
      (clrhash tramp-cache-data))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]