aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2015-10-28 15:31:40 +0100
committerMichael Albinus2015-10-28 15:31:40 +0100
commit9fd61a5aa2961d18ae00700bcbb527e5a643f3a2 (patch)
tree122febd59386f031aac20784ddb656e3e7c333e2
parent1e2ed2687ad35d7a3efee1ef1d482d595eb0879f (diff)
downloademacs-9fd61a5aa2961d18ae00700bcbb527e5a643f3a2.tar.gz
emacs-9fd61a5aa2961d18ae00700bcbb527e5a643f3a2.zip
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.
-rw-r--r--lisp/net/tramp-compat.el10
-rw-r--r--lisp/net/tramp-smb.el6
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.
592(unless (fboundp 'format-message) 592(unless (fboundp 'format-message)
593 (defalias 'format-message 'format)) 593 (defalias 'format-message 'format))
594 594
595;; `delete-dups' does not exist in XEmacs 21.4.
596(if (fboundp 'delete-dups)
597 (defalias 'tramp-compat-delete-dups 'delete-dups)
598 (defun tramp-compat-delete-dups (list)
599 "Destructively remove `equal' duplicates from LIST.
600Store the result in LIST and return it. LIST must be a proper list.
601Of several `equal' occurrences of an element in LIST, the first
602one is kept."
603 (cl-delete-duplicates list '(:test equal :from-end) nil)))
604
595(add-hook 'tramp-unload-hook 605(add-hook 'tramp-unload-hook
596 (lambda () 606 (lambda ()
597 (unload-feature 'tramp-loaddefs 'force) 607 (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."
649 (directory &optional full match nosort) 649 (directory &optional full match nosort)
650 "Like `directory-files' for Tramp files." 650 "Like `directory-files' for Tramp files."
651 (let ((result (mapcar 'directory-file-name 651 (let ((result (mapcar 'directory-file-name
652 (file-name-all-completions "" directory))) 652 (file-name-all-completions "" directory))))
653 res)
654 ;; Discriminate with regexp. 653 ;; Discriminate with regexp.
655 (when match 654 (when match
656 (setq result 655 (setq result
@@ -666,8 +665,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
666 ;; Sort them if necessary. 665 ;; Sort them if necessary.
667 (unless nosort (setq result (sort result 'string-lessp))) 666 (unless nosort (setq result (sort result 'string-lessp)))
668 ;; Remove double entries. 667 ;; Remove double entries.
669 (dolist (elt result res) 668 (tramp-compat-delete-dups result)))
670 (add-to-list 'res elt 'append))))
671 669
672(defun tramp-smb-handle-expand-file-name (name &optional dir) 670(defun tramp-smb-handle-expand-file-name (name &optional dir)
673 "Like `expand-file-name' for Tramp files." 671 "Like `expand-file-name' for Tramp files."