aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.dev>2026-03-04 21:33:39 +0200
committerBozhidar Batsov <bozhidar@batsov.dev>2026-03-04 21:43:10 +0200
commitd29b5b3526b4ee0335e92f93997cb4ac12f14fef (patch)
tree892e45080610d63e3bcf504678b4216fedaff8f6
parent8f027305c20cf98677bf02c95b67ab31fdecdfd2 (diff)
Replace broken sort with partition in projectile--other-extension-files
The seq-sort comparator ignored its second argument, producing undefined ordering. The intent was just to prioritize files from sibling directories. Replace with a clear two-bucket partition: sibling-dir files first, then the rest.
-rw-r--r--projectile.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/projectile.el b/projectile.el
index 8fccc9b..65b38ee 100644
--- a/projectile.el
+++ b/projectile.el
@@ -2481,13 +2481,14 @@ With FLEX-MATCHING, match any file that contains the base name of current file"
file-list)))
(candidates
(seq-filter (lambda (file) (not (backup-file-name-p file))) candidates))
- (candidates
- (seq-sort (lambda (file _)
- (let ((candidate-dirname (file-name-nondirectory (directory-file-name (if (file-name-directory file)
- (file-name-directory file) "./")))))
- (unless (equal fulldirname (file-name-directory file))
- (equal dirname candidate-dirname))))
- candidates)))
+ (sibling-dir-p (lambda (file)
+ (let ((candidate-dirname (file-name-nondirectory
+ (directory-file-name
+ (or (file-name-directory file) "./")))))
+ (and (not (equal fulldirname (file-name-directory file)))
+ (equal dirname candidate-dirname)))))
+ (candidates (append (seq-filter sibling-dir-p candidates)
+ (seq-remove sibling-dir-p candidates))))
candidates))
(defun projectile-select-files (project-files &optional invalidate-cache)