Make heredocs more robust in Tramp.
[bpt/emacs.git] / lisp / net / tramp-cache.el
index b4e5e4f..825731c 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tramp-cache.el --- file information caching for Tramp
 
-;; Copyright (C) 2000, 2005-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2005-2014 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pittman <daniel@inanna.danann.net>
 ;;         Michael Albinus <michael.albinus@gmx.de>
@@ -285,16 +285,21 @@ KEY identifies the connection, it is either a process or a vector."
     (let (result)
       (maphash
        (lambda (key value)
-        ;; Remove text properties from KEY.
-        (when (vectorp key)
-          (dotimes (i (length key))
-            (when (stringp (aref key i))
-              (aset key i
-                    (funcall
-                     ;; `substring-no-properties' does not exist in XEmacs.
-                     (if (functionp 'substring-no-properties)
-                         'substring-no-properties 'identity)
-                     (aref key i))))))
+        ;; Remove text properties from KEY and VALUE.
+        ;; `substring-no-properties' does not exist in XEmacs.
+        (when (functionp 'substring-no-properties)
+          (when (vectorp key)
+            (dotimes (i (length key))
+              (when (stringp (aref key i))
+                (aset key i
+                      (tramp-compat-funcall
+                       'substring-no-properties (aref key i))))))
+          (when (stringp key)
+            (setq key (tramp-compat-funcall 'substring-no-properties key)))
+          (when (stringp value)
+            (setq value
+                  (tramp-compat-funcall 'substring-no-properties value))))
+        ;; Dump.
         (let ((tmp (format
                     "(%s %s)"
                     (if (processp key)
@@ -400,6 +405,7 @@ for all methods.  Resulting data are derived from connection history."
       (with-temp-buffer
        (insert-file-contents tramp-persistency-file-name)
        (let ((list (read (current-buffer)))
+             (tramp-verbose 0)
              element key item)
          (while (setq element (pop list))
            (setq key (pop element))