From 38726039b77db432989fed106c88e9f1aa463281 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 3 Sep 2013 16:14:58 -0400 Subject: [PATCH] * lisp/net/tramp-gvfs.el (tramp-gvfs-mount-spec, tramp-synce-list-devices): * 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 | 5 +++ lisp/net/tramp-gvfs.el | 77 ++++++++++++++++++------------------------ lisp/net/tramp-sh.el | 12 +++---- lisp/net/tramp-smb.el | 4 +-- 4 files changed, 46 insertions(+), 52 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 468f7c7d70d..a9d62d17b21 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2013-09-03 Stefan Monnier + * 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'. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 9ae352eccc1..e70400af820 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -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)) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ac131765189..8ca94122af1 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -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 diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 569bfb9c874..f05a54f46f7 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -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. -- 2.39.2