aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.dev>2026-02-28 10:46:46 +0200
committerBozhidar Batsov <bozhidar@batsov.dev>2026-02-28 10:51:37 +0200
commit1a116656aad0fc6929c3058b2034052f3048e375 (patch)
treeec61e9a6db7a7d1bc215cbfebc657509f31998f1
parent38502ba818b5f65ddab58c83dae1dbafe80102b0 (diff)
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.
-rw-r--r--projectile.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/projectile.el b/projectile.el
index a0eaebf..cc99ea4 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.