branch: elpa/helm
commit 3a8164f6df960802c16e447bcb0dcb089c13f791
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    New function helm-copy-sequence
    
    Use it for recentf.
---
 helm-for-files.el |  3 +--
 helm-lib.el       | 10 ++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/helm-for-files.el b/helm-for-files.el
index 07e49e3f53..e812f3f10d 100644
--- a/helm-for-files.el
+++ b/helm-for-files.el
@@ -128,8 +128,7 @@ Be aware that a nil value will make tramp display very 
slow."
                            ;; be read at startup), until now it was working by
                            ;; chance because the display candidate was
                            ;; let-bounded before being modified.
-                           (cl-loop for file in recentf-list
-                                    collect (substring-no-properties file))))
+                           (helm-copy-sequence recentf-list)))
    (pattern-transformer :initform 'helm-recentf-pattern-transformer)
    (match-part :initform (lambda (candidate)
                            (if (or helm-ff-transformer-show-only-basename
diff --git a/helm-lib.el b/helm-lib.el
index 14724617b3..5ff68bfca7 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -1191,6 +1191,16 @@ If keyword FROM-END is non nil search from end."
                      elm)
         (cl-return-from helm-position count))
       (setq count (funcall (if from-end #'1- #'1+) count)))))
+
+(defsubst helm-copy-sequence (seq)
+  "Return a copy of SEQ.
+When the elements of SEQ are strings, they are
+copied; they are not shared with the original.
+Otherwise returns SEQ unchanged, the elements are not copied."
+  (cl-loop for elm in seq collect
+           (if (stringp elm)
+               (copy-sequence elm)
+             elm)))
 
 ;;; Strings processing.
 ;;

Reply via email to