]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el (tramp-check-proper-method-and-host): Rename it from
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 13 Sep 2013 06:03:06 +0000 (08:03 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 13 Sep 2013 06:03:06 +0000 (08:03 +0200)
`tramp-check-proper-host'.  Check for a valid method name.

* net/tramp-adb.el (tramp-adb-maybe-open-connection):
* net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
* net/tramp-sh.el (tramp-maybe-open-connection):
* net/tramp-smb.el (tramp-smb-maybe-open-connection): Call it.

* net/tramp-cache.el (tramp-cache-print): Don't print text properties
also for hash values.

lisp/ChangeLog
lisp/net/tramp-adb.el
lisp/net/tramp-cache.el
lisp/net/tramp-gvfs.el
lisp/net/tramp-sh.el
lisp/net/tramp-smb.el
lisp/net/tramp.el

index 7dea339d669165ad11c20443eab17075c8cf3f65..de9b8d9151625946bcfdb1f460b35394a0d5070d 100644 (file)
@@ -1,3 +1,16 @@
+2013-09-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-check-proper-method-and-host): Rename it from
+       `tramp-check-proper-host'.  Check for a valid method name.
+
+       * net/tramp-adb.el (tramp-adb-maybe-open-connection):
+       * net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
+       * net/tramp-sh.el (tramp-maybe-open-connection):
+       * net/tramp-smb.el (tramp-smb-maybe-open-connection): Call it.
+
+       * net/tramp-cache.el (tramp-cache-print): Don't print text properties
+       also for hash values.
+
 2013-09-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * term/ns-win.el (parameters): Don't declare as dynamic.
index 595037ab94392cfcbf0045f17bcd38f98aa057b2..132ffaa27a88106ab3d0750eb1c13dbe0ca4b2f8 100644 (file)
@@ -1092,7 +1092,7 @@ FMT and ARGS are passed to `error'."
   "Maybe open a connection VEC.
 Does not do anything if a connection is already open, but re-opens the
 connection if a previous connection has died for some reason."
-  (tramp-check-proper-host vec)
+  (tramp-check-proper-method-and-host vec)
 
   (let* ((buf (tramp-get-connection-buffer vec))
         (p (get-buffer-process buf))
index b4e5e4ffd0fbbbf53f9ef2a150c2f8ed7c122cc5..7407f83e92b319b61b73a385d8998246b8838ca1 100644 (file)
@@ -285,16 +285,18 @@ 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 (funcall 'substring-no-properties (aref key i))))))
+          (when (stringp key)
+            (setq key (funcall 'substring-no-properties key)))
+          (when (stringp value)
+            (setq value (funcall 'substring-no-properties value))))
+        ;; Dump.
         (let ((tmp (format
                     "(%s %s)"
                     (if (processp key)
index e764e4767dd50ffacbef71999b60acfb7fa62951..8f79e495420a95a21c140f89348665f8d67fdf64 100644 (file)
@@ -1465,7 +1465,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
   "Maybe open a connection VEC.
 Does not do anything if a connection is already open, but re-opens the
 connection if a previous connection has died for some reason."
-  (tramp-check-proper-host vec)
+  (tramp-check-proper-method-and-host vec)
 
   ;; We set the file name, in case there are incoming D-Bus signals or
   ;; D-Bus errors.
index f91cbb29a1d1473071ead523d83e656faf81258c..e37c34e0df9b0c5d73c4f54b2d27e85b71f5eb7f 100644 (file)
@@ -4286,7 +4286,7 @@ Gateway hops are already opened."
   "Maybe open a connection VEC.
 Does not do anything if a connection is already open, but re-opens the
 connection if a previous connection has died for some reason."
-  (tramp-check-proper-host vec)
+  (tramp-check-proper-method-and-host vec)
 
   (let ((p (tramp-get-connection-process vec))
        (process-name (tramp-get-connection-property vec "process-name" nil))
index 27f3bd41e9c6fe0c7cc6e5314ba4e4dcc1766d88..03ad62be0a50d8ced7fcd9d0cc588c34d732f668 100644 (file)
@@ -1566,7 +1566,7 @@ Does not do anything if a connection is already open, but re-opens the
 connection if a previous connection has died for some reason.
 If ARGUMENT is non-nil, use it as argument for
 `tramp-smb-winexe-program', and suppress any checks."
-  (tramp-check-proper-host vec)
+  (tramp-check-proper-method-and-host vec)
 
   (let* ((share (tramp-smb-get-share vec))
         (buf (tramp-get-connection-buffer vec))
index fe4f7b8bb54acf1c97c21162ea5c7c34a56a438d..48420aad5a3289791e46023f555f2d449330f9d1 100644 (file)
@@ -1265,15 +1265,19 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
        lhost)
       tramp-default-host))
 
-(defun tramp-check-proper-host (vec)
-  "Check host name of VEC."
+(defun tramp-check-proper-method-and-host (vec)
+  "Check method and host name of VEC."
   (let ((method (tramp-file-name-method vec))
        (user (tramp-file-name-user vec))
-       (host (tramp-file-name-host vec)))
+       (host (tramp-file-name-host vec))
+       (methods (mapcar 'car tramp-methods)))
+    (when (and method (not (member method methods)))
+      (tramp-cleanup-connection vec)
+      (tramp-user-error vec "Unknown method \"%s\"" method))
     (when (and (equal tramp-syntax 'ftp) host
               (or (null method) (get-text-property 0 'tramp-default method))
               (or (null user) (get-text-property 0 'tramp-default user))
-              (member host (mapcar 'car tramp-methods)))
+              (member host methods))
       (tramp-cleanup-connection vec)
       (tramp-user-error vec "Host name must not match method \"%s\"" host))))