branch: externals/xeft
commit 289bb33b2d72299a6c4bd51d3afdf5469c5cbb50
Author: Yuan Fu <caso...@gmail.com>
Commit: Yuan Fu <caso...@gmail.com>

    Sort results by last access time (issue#38)
    
    * xeft.el (xeft-refresh): Sort results by last access time.
---
 xeft.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xeft.el b/xeft.el
index 5d8db352a8..d4639d0867 100644
--- a/xeft.el
+++ b/xeft.el
@@ -842,6 +842,13 @@ non-nil, display all results."
                  ;; 16 is just larger than 15, so we will know it when
                  ;; there are more results.
                  0 (if full 2147483647 16))))
+        ;; Sort results by last access time.
+        (setq file-list
+              (cl-stable-sort file-list
+                              (lambda (f1 f2)
+                                (not (time-less-p
+                                      (nth 4 (file-attributes f1))
+                                      (nth 4 (file-attributes f2)))))))
         (when (and (null full) (> (length file-list) 15))
           (setq file-list (cl-subseq file-list 0 15)
                 list-clipped t))

Reply via email to