Or at least that's what it looks like! It's a bit hard for me to isolate, but here's my particular setup:
- My goal is to use counsel-projectile-find-file, defaulting directory when I am not in a project.
(global-set-key (kbd "C-c f") (lambda () (interactive) (let ((default-directory (or default-directory "~/Dropbox/Notes"))) (counsel-projectile-find-file))))
- As described in the manual for counsel-projectile, I have edited the variable
'(counsel-projectile-find-file . file-newer-than-file-p))to sort by file creation date (I actually wrote a custom function, but the bug is still there if I use this built-in sort function).
- Now, when I
C-c fto look for a file from not in a project (e.g. dashboard,
*messages*, etc.) this works correctly; after I pick a project, the files are sorted and typing things narrows down the search, but still sorted from newer files to old.
- However, if I'm already in a project, then the files are not sorted; they're just in alphabetical order.
I've tried to do my homework by looking hard at the code for
counsel-projectile-find-file, but I am unable to decipher this difference in behavior. Any ideas would be appreciated!