branch: elpa/projectile
commit 1a116656aad0fc6929c3058b2034052f3048e375
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Use append instead of nconc in projectile--merge-related-files-fns
    
    nconc destructively modifies the existing plist value, which can
    corrupt shared data from related-files-fn return values. It also
    silently drops values when the existing list is nil (nconc of nil
    doesn't update the plist entry in place). Using append with
    explicit plist-put fixes both issues.
---
 projectile.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/projectile.el b/projectile.el
index a0eaebf0e6..cc99ea4225 100644
--- a/projectile.el
+++ b/projectile.el
@@ -2820,9 +2820,9 @@ With a prefix arg INVALIDATE-CACHE invalidates the cache 
first."
         (let ((plist (funcall fn path)))
           (cl-loop for (key value) on plist by #'cddr
                    do (let ((values (if (consp value) value (list value))))
-                        (if (plist-member merged-plist key)
-                            (nconc (plist-get merged-plist key) values)
-                          (setq merged-plist (plist-put merged-plist key 
values))))))))))
+                        (setq merged-plist
+                              (plist-put merged-plist key
+                                         (append (plist-get merged-plist key) 
values))))))))))
 
 (defun projectile--related-files-plist (project-root file)
   "Return a plist containing all related files information for FILE.

Reply via email to