bbatsov/projectile — pull request #353 by jimeh (2014-05-23 20:23:09+00:00)
Title: Add recently-active sort order option

I'd consider this a quite hacky implementation, as my lisp skills are mostly on a "monkey see, monkey do" level. I've tried to understand the existing code around sorting, how it works, and attempted to implement this in a seemingly similar and sane manner.

The idea behind this sorting mode, is that projectile can almost completely replace `C-x C-f` and `C-x b` by making it easier to get to files you recently looked at, but at the same time easily allowing the opening of any file in the project.

Overall, recently-active sorting operates in three stages/groups:

1. First come any files of open project buffers, sorted by when said buffer was last active.
2. Secondly recentf is used. As far as I understand they're sorted based on when the file was opened.
3. All remaining project files.

I did experiment with removing the current buffer's file from the first open buffers stage, but opted against it I personally felt it gave a nice context to default to the current buffer's file at the top of the file list.

P.S. Please feel free to point out anything silly/stupid. Like I said, my Lisp skills are bare minimum, and as far as I can tell, this works as I want it to. And hopefully it's good enough for you merge in with or without massive fixes/tweaks on your end :)