Commit 9fd61a5a authored by Michael Albinus's avatar Michael Albinus
Browse files

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.
parent 1e2ed268
......@@ -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)
......
......@@ -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."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment