]> code.delx.au - gnu-emacs/commitdiff
* net/tramp-cache.el (tramp-connection-properties): New customer option.
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 16 Feb 2013 17:44:00 +0000 (18:44 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 16 Feb 2013 17:44:00 +0000 (18:44 +0100)
(tramp-get-connection-property): Use it.

* net/tramp-compat.el (top): Require 'trampver.

* net/tramp-sh.el (tramp-remote-process-environment): Set
tramp-autoload cookie.

lisp/ChangeLog
lisp/net/tramp-cache.el
lisp/net/tramp-compat.el
lisp/net/tramp-sh.el

index 0718296dffd3b6d954ef1e9ea45d1aaacd4529d6..dd738ca9430c76270289ea9e7705ca604319e116 100644 (file)
@@ -1,3 +1,14 @@
+2013-02-16  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-cache.el (tramp-connection-properties): New customer
+       option.
+       (tramp-get-connection-property): Use it.
+
+       * net/tramp-compat.el (top): Require 'trampver.
+
+       * net/tramp-sh.el (tramp-remote-process-environment): Set
+       tramp-autoload cookie.
+
 2013-02-16  Kevin Ryde  <user42@zip.com.au>
 
        * info-look.el (info-lookup-select-mode): If major-mode has no
index d1ef1739bf78bca15572d9998eb8f3c8f2525d22..dc45a57b7c668cfc8738dd6f6332dff4fdb394ff 100644 (file)
 (defvar tramp-cache-data (make-hash-table :test 'equal)
   "Hash table for remote files properties.")
 
+;;;###tramp-autoload
+(defcustom tramp-connection-properties nil
+  "List of static connection properties.
+Every entry has the form (REGEXP PROPERTY VALUE).  The regexp
+matches remote file names.  It can be nil.  PROPERTY is a string,
+and VALUE the corresponding value.  They are used, if there is no
+matching entry in for PROPERTY in `tramp-cache-data'."
+  :group 'tramp
+  :version "24.4"
+  :type '(repeat (list (choice :tag "File Name regexp" regexp (const nil))
+                      (choice :tag "        Property" string)
+                      (choice :tag "           Value" sexp))))
+
 (defcustom tramp-persistency-file-name
   (cond
    ;; GNU Emacs.
@@ -204,9 +217,27 @@ If the value is not set for the connection, returns DEFAULT."
     (setq key (copy-sequence key))
     (aset key 3 nil))
   (let* ((hash (gethash key tramp-cache-data))
-        (value (if (hash-table-p hash)
-                   (gethash property hash default)
-                 default)))
+        (value
+         (catch 'result
+           (or
+            ;; Check for dynamic properties.
+            (and
+             (hash-table-p hash)
+             (maphash
+              (lambda (x y) (when (equal x property) (throw 'result y)))
+              hash))
+            ;; Check for static properties.
+            (and
+             (vectorp key)
+             (dolist (elt tramp-connection-properties)
+               (when (and (string-match
+                           (or (nth 0 elt) "")
+                           (tramp-make-tramp-file-name
+                            (aref key 0) (aref key 1) (aref key 2) nil))
+                          (string-equal (or (nth 1 elt) "") (or property "")))
+                 (throw 'result (nth 2 elt)))))
+            ;; The default value.
+            default))))
     (tramp-message key 7 "%s %s" property value)
     value))
 
index 12510bf7fabd0fe5bd412fe54965f66dcd5678a7..81c4d5ccced9138a1784dd9a2e8b8e8a187ae397 100644 (file)
@@ -52,6 +52,7 @@
   (require 'format-spec)
   (require 'shell)
 
+  (require 'trampver)
   (require 'tramp-loaddefs)
 
   ;; As long as password.el is not part of (X)Emacs, it shouldn't be
index 001a27f3b2e9915f02f025e1217186ed78d0503a..9be22352b2323871119a8d1b9b50e3120119b4db 100644 (file)
@@ -512,6 +512,7 @@ as given in your `~/.profile'."
                  (const :tag "Private Directories" tramp-own-remote-path)
                  (string :tag "Directory"))))
 
+;;;###tramp-autoload
 (defcustom tramp-remote-process-environment
   `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_ALL=C"
     ,(format "TERM=%s" tramp-terminal-type)