From 6d0932321878bdde064b4fbe8aa9f9304dd6cb53 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Mon, 7 Sep 2020 10:14:49 +0800 Subject: [PATCH] (fix): fix sort by mtime in completions (#1087) --- org-roam.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/org-roam.el b/org-roam.el index c2c014d..2a6a9a1 100644 --- a/org-roam.el +++ b/org-roam.el @@ -859,10 +859,10 @@ to the file." :left :join files :on (= titles:file files:file)])) completions) - (seq-sort-by (lambda (x) - (plist-get (nth 3 x) :mtime)) - #'time-less-p - rows) + (setq rows (seq-sort-by (lambda (x) + (plist-get (nth 3 x) :mtime)) + #'time-less-p + rows)) (dolist (row rows completions) (pcase-let ((`(,file-path ,title ,tags) row)) (let ((k (org-roam--prepend-tag-string title tags)) @@ -915,10 +915,10 @@ FILTER can either be a string or a function: :left :join refs :on (= titles:file refs:file) :where refs:file :is :not :null])) completions) - (seq-sort-by (lambda (x) - (plist-get (nth 3 x) :mtime)) - #'time-less-p - rows) + (setq rows (seq-sort-by (lambda (x) + (plist-get (nth 3 x) :mtime)) + #'time-less-p + rows)) (dolist (row rows completions) (pcase-let ((`(,type ,ref ,file-path ,title ,tags) row)) (when (pcase filter