summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-cache.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net/tramp-cache.el')
-rw-r--r--lisp/net/tramp-cache.el65
1 files changed, 25 insertions, 40 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 26825ffa2dd..158cfb5cae3 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -75,25 +75,7 @@ details see the info pages."
(choice :tag " Value" sexp))))
(defcustom tramp-persistency-file-name
- (cond
- ;; GNU Emacs.
- ((and (fboundp 'locate-user-emacs-file))
- (expand-file-name (tramp-compat-funcall 'locate-user-emacs-file "tramp")))
- ((and (boundp 'user-emacs-directory)
- (stringp (symbol-value 'user-emacs-directory))
- (file-directory-p (symbol-value 'user-emacs-directory)))
- (expand-file-name "tramp" (symbol-value 'user-emacs-directory)))
- ((and (not (featurep 'xemacs)) (file-directory-p "~/.emacs.d/"))
- "~/.emacs.d/tramp")
- ;; XEmacs.
- ((and (boundp 'user-init-directory)
- (stringp (symbol-value 'user-init-directory))
- (file-directory-p (symbol-value 'user-init-directory)))
- (expand-file-name "tramp" (symbol-value 'user-init-directory)))
- ((and (featurep 'xemacs) (file-directory-p "~/.xemacs/"))
- "~/.xemacs/tramp")
- ;; For users without `~/.emacs.d/' or `~/.xemacs/'.
- (t "~/.tramp"))
+ (expand-file-name (locate-user-emacs-file "tramp"))
"File which keeps connection history for Tramp connections."
:group 'tramp
:type 'file)
@@ -241,8 +223,10 @@ This is suppressed for temporary buffers."
;;;###tramp-autoload
(defun tramp-get-connection-property (key property default)
"Get the named PROPERTY for the connection.
-KEY identifies the connection, it is either a process or a vector.
-If the value is not set for the connection, returns DEFAULT."
+KEY identifies the connection, it is either a process or a
+vector. A special case is nil, which is used to cache connection
+properties of the local machine. If the value is not set for the
+connection, returns DEFAULT."
;; Unify key by removing localname and hop from vector. Work with a
;; copy in order to avoid side effects.
(when (vectorp key)
@@ -259,8 +243,10 @@ If the value is not set for the connection, returns DEFAULT."
;;;###tramp-autoload
(defun tramp-set-connection-property (key property value)
"Set the named PROPERTY of a connection to VALUE.
-KEY identifies the connection, it is either a process or a vector.
-PROPERTY is set persistent when KEY is a vector."
+KEY identifies the connection, it is either a process or a
+vector. A special case is nil, which is used to cache connection
+properties of the local machine. PROPERTY is set persistent when
+KEY is a vector."
;; Unify key by removing localname and hop from vector. Work with a
;; copy in order to avoid side effects.
(when (vectorp key)
@@ -276,13 +262,17 @@ PROPERTY is set persistent when KEY is a vector."
;;;###tramp-autoload
(defun tramp-connection-property-p (key property)
"Check whether named PROPERTY of a connection is defined.
-KEY identifies the connection, it is either a process or a vector."
+KEY identifies the connection, it is either a process or a
+vector. A special case is nil, which is used to cache connection
+properties of the local machine."
(not (eq (tramp-get-connection-property key property 'undef) 'undef)))
;;;###tramp-autoload
(defun tramp-flush-connection-property (key)
"Remove all properties identified by KEY.
-KEY identifies the connection, it is either a process or a vector."
+KEY identifies the connection, it is either a process or a
+vector. A special case is nil, which is used to cache connection
+properties of the local machine."
;; Unify key by removing localname and hop from vector. Work with a
;; copy in order to avoid side effects.
(when (vectorp key)
@@ -307,19 +297,14 @@ KEY identifies the connection, it is either a process or a vector."
(maphash
(lambda (key value)
;; 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))))
+ (when (vectorp key)
+ (dotimes (i (length key))
+ (when (stringp (aref key i))
+ (aset key i (substring-no-properties (aref key i))))))
+ (when (stringp key)
+ (setq key (substring-no-properties key)))
+ (when (stringp value)
+ (setq value (substring-no-properties value)))
;; Dump.
(let ((tmp (format
"(%s %s)"
@@ -418,8 +403,8 @@ for all methods. Resulting data are derived from connection history."
;; When "emacs -Q" has been called, both variables are nil.
;; We do not load the persistency file then, in order to
;; have a clean test environment.
- (or (and (boundp 'init-file-user) (symbol-value 'init-file-user))
- (and (boundp 'site-run-file) (symbol-value 'site-run-file))))
+ (or init-file-user
+ site-run-file))
(condition-case err
(with-temp-buffer
(insert-file-contents tramp-persistency-file-name)