0

Or at least that's what it looks like! It's a bit hard for me to isolate, but here's my particular setup:

  1. 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))))
  1. As described in the manual for counsel-projectile, I have edited the variable ivy-sort-functions-alist to contain '(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).
  2. Now, when I C-c f to 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.
  3. 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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.