]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/net/tramp-gvfs.el (tramp-gvfs-mount-spec, tramp-synce-list-devices):
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Sep 2013 20:14:58 +0000 (16:14 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Sep 2013 20:14:58 +0000 (16:14 -0400)
* lisp/net/tramp-smb.el (tramp-smb-get-file-entries):
* lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory)
(tramp-compute-multi-hops): Fix misuses of `add-to-list'.

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

index 468f7c7d70da9fd9de78e52d1f8ea36c12c1b173..a9d62d17b212f63795edeb9b1a4cd5f147129ffb 100644 (file)
@@ -1,5 +1,10 @@
 2013-09-03  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * net/tramp-gvfs.el (tramp-gvfs-mount-spec, tramp-synce-list-devices): 
+       * net/tramp-smb.el (tramp-smb-get-file-entries):
+       * net/tramp-sh.el (tramp-sh-handle-insert-directory)
+       (tramp-compute-multi-hops): Fix misuses of `add-to-list'.
+
        * net/eww.el (eww-display-raw): Remove unused argument `charset'.
        Update call to it.
        (eww-change-select): Remove unused var `properties'.
index 9ae352eccc165c33604e185511ae28635adb846a..e70400af820f14bd7a2fbf87b6719a2c6686bb04 100644 (file)
@@ -1417,47 +1417,36 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
         (port (tramp-file-name-port vec))
         (localname (tramp-file-name-localname vec))
         (ssl (if (string-match "^davs" method) "true" "false"))
-        (mount-spec '(:array))
-        (mount-pref "/"))
-
-    (setq
-     mount-spec
-     (append
-      mount-spec
-      (cond
-       ((string-equal "smb" method)
-       (string-match "^/?\\([^/]+\\)" localname)
-       (list (tramp-gvfs-mount-spec-entry "type" "smb-share")
-             (tramp-gvfs-mount-spec-entry "server" host)
-             (tramp-gvfs-mount-spec-entry "share" (match-string 1 localname))))
-       ((string-equal "obex" method)
-       (list (tramp-gvfs-mount-spec-entry "type" method)
-             (tramp-gvfs-mount-spec-entry
-              "host" (concat "[" (tramp-bluez-address host) "]"))))
-       ((string-match "^dav" method)
-       (list (tramp-gvfs-mount-spec-entry "type" "dav")
-             (tramp-gvfs-mount-spec-entry "host" host)
-             (tramp-gvfs-mount-spec-entry "ssl" ssl)))
-       (t
-       (list (tramp-gvfs-mount-spec-entry "type" method)
-             (tramp-gvfs-mount-spec-entry "host" host))))))
-
-    (when user
-      (add-to-list
-       'mount-spec (tramp-gvfs-mount-spec-entry "user" user) 'append))
-
-    (when domain
-      (add-to-list
-       'mount-spec (tramp-gvfs-mount-spec-entry "domain" domain) 'append))
-
-    (when port
-      (add-to-list
-       'mount-spec (tramp-gvfs-mount-spec-entry "port" (number-to-string port))
-       'append))
-
-    (when (and (string-match "^dav" method)
-              (string-match "^/?[^/]+" localname))
-      (setq mount-pref (match-string 0 localname)))
+        (mount-spec
+          `(:array
+            ,@(cond
+               ((string-equal "smb" method)
+                (string-match "^/?\\([^/]+\\)" localname)
+                (list (tramp-gvfs-mount-spec-entry "type" "smb-share")
+                      (tramp-gvfs-mount-spec-entry "server" host)
+                      (tramp-gvfs-mount-spec-entry "share" (match-string 1 localname))))
+               ((string-equal "obex" method)
+                (list (tramp-gvfs-mount-spec-entry "type" method)
+                      (tramp-gvfs-mount-spec-entry
+                       "host" (concat "[" (tramp-bluez-address host) "]"))))
+               ((string-match "\\`dav" method)
+                (list (tramp-gvfs-mount-spec-entry "type" "dav")
+                      (tramp-gvfs-mount-spec-entry "host" host)
+                      (tramp-gvfs-mount-spec-entry "ssl" ssl)))
+               (t
+                (list (tramp-gvfs-mount-spec-entry "type" method)
+                      (tramp-gvfs-mount-spec-entry "host" host))))
+            ,@(when user
+                (list (tramp-gvfs-mount-spec-entry "user" user)))
+            ,@(when domain
+                (list (tramp-gvfs-mount-spec-entry "domain" domain)))
+            ,@(when port
+                (list (tramp-gvfs-mount-spec-entry "port" (number-to-string port))))))
+        (mount-pref
+          (if (and (string-match "\\`dav" method)
+                   (string-match "^/?[^/]+" localname))
+              (match-string 0 localname)
+            "/")))
 
     ;; Return.
     `(:struct ,(tramp-gvfs-dbus-string-to-byte-array mount-pref) ,mount-spec)))
@@ -1718,11 +1707,11 @@ They are retrieved from the hal daemon."
       (when (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t
              :system tramp-hal-service device tramp-hal-interface-device
              "PropertyExists" "sync.plugin")
-       (add-to-list
-        'tramp-synce-devices
+       (pushnew
         (with-tramp-dbus-call-method tramp-gvfs-dbus-event-vector t
           :system tramp-hal-service device tramp-hal-interface-device
-          "GetPropertyString" "pda.pocketpc.name"))))
+          "GetPropertyString" "pda.pocketpc.name")
+         tramp-synce-devices :test #'equal)))
     (tramp-message tramp-gvfs-dbus-event-vector 10 "%s" tramp-synce-devices)
     tramp-synce-devices))
 
index ac13176518934726dd75747b44dd7bd9ddd3f026..8ca94122af14b63730b54750342df95ae136bb48 100644 (file)
@@ -2500,8 +2500,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
                        'file-name-nondirectory (list localname)))
         (setq localname (tramp-run-real-handler
                         'file-name-directory (list localname))))
-      (unless full-directory-p
-        (setq switches (add-to-list 'switches "-d" 'append)))
+      (unless (or full-directory-p (member "-d" switches))
+        (setq switches (append switches '("-d"))))
       (setq switches (mapconcat 'tramp-shell-quote-argument switches " "))
       (when wildcard
        (setq switches (concat switches " " wildcard)))
@@ -4252,7 +4252,7 @@ Gateway hops are already opened."
                  ?h (or (tramp-file-name-host (car target-alist)) ""))))
          (with-parsed-tramp-file-name proxy l
            ;; Add the hop.
-           (add-to-list 'target-alist l)
+           (pushnew l target-alist :test #'equal)
            ;; Start next search.
            (setq choices tramp-default-proxies-alist)))))
 
@@ -4270,11 +4270,11 @@ Gateway hops are already opened."
           vec 'file-error
           "Connection `%s' is not supported for gateway access." hop))
        ;; Open the gateway connection.
-       (add-to-list
-        'target-alist
+       (pushnew
         (vector
          (tramp-file-name-method hop) (tramp-file-name-user hop)
-         (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil))
+         (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil)
+        target-alist :test #'equal)
        ;; For the password prompt, we need the correct values.
        ;; Therefore, we must remember the gateway vector.  But we
        ;; cannot do it as connection property, because it shouldn't
index 569bfb9c8748aef4a4cbaeaa7348bf77121d6a49..f05a54f46f7d445e5a84084f646a64e8126c5abb 100644 (file)
@@ -1364,14 +1364,14 @@ Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
              (while (not (eobp))
                (setq entry (tramp-smb-read-file-entry share))
                (forward-line)
-               (when entry (add-to-list 'res entry))))
+               (when entry (pushnew entry res :test #'equal))))
 
            ;; Cache share entries.
            (unless share
              (tramp-set-connection-property v "share-cache" res)))
 
          ;; Add directory itself.
-         (add-to-list 'res '("" "drwxrwxrwx" 0 (0 0)))
+         (pushnew '("" "drwxrwxrwx" 0 (0 0)) res :test #'equal)
 
          ;; There's a very strange error (debugged with XEmacs 21.4.14)
          ;; If there's no short delay, it returns nil.  No idea about.