diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2015-10-28 15:31:40 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2015-10-28 15:31:40 +0100 |
commit | 9fd61a5aa2961d18ae00700bcbb527e5a643f3a2 (patch) | |
tree | 122febd59386f031aac20784ddb656e3e7c333e2 /lisp | |
parent | 1e2ed2687ad35d7a3efee1ef1d482d595eb0879f (diff) | |
download | emacs-9fd61a5aa2961d18ae00700bcbb527e5a643f3a2.tar.gz |
Avoid using `add-to-list' on a let-local var in tramp-smb.el
* lisp/net/tramp-compat.el (tramp-compat-delete-dups): New defun.
* lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Use it.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/net/tramp-compat.el | 10 | ||||
-rw-r--r-- | lisp/net/tramp-smb.el | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 7157ac25fa2..c57102881bf 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -592,6 +592,16 @@ and replace a sub-expression, e.g. (unless (fboundp 'format-message) (defalias 'format-message 'format)) +;; `delete-dups' does not exist in XEmacs 21.4. +(if (fboundp 'delete-dups) + (defalias 'tramp-compat-delete-dups 'delete-dups) + (defun tramp-compat-delete-dups (list) + "Destructively remove `equal' duplicates from LIST. +Store the result in LIST and return it. LIST must be a proper list. +Of several `equal' occurrences of an element in LIST, the first +one is kept." + (cl-delete-duplicates list '(:test equal :from-end) nil))) + (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-loaddefs 'force) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 5910d1fd3a4..c95679584dc 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -649,8 +649,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (directory &optional full match nosort) "Like `directory-files' for Tramp files." (let ((result (mapcar 'directory-file-name - (file-name-all-completions "" directory))) - res) + (file-name-all-completions "" directory)))) ;; Discriminate with regexp. (when match (setq result @@ -666,8 +665,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; Sort them if necessary. (unless nosort (setq result (sort result 'string-lessp))) ;; Remove double entries. - (dolist (elt result res) - (add-to-list 'res elt 'append)))) + (tramp-compat-delete-dups result))) (defun tramp-smb-handle-expand-file-name (name &optional dir) "Like `expand-file-name' for Tramp files." |