[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra a159810 120/395: counsel-recentf: Sort by acc
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra a159810 120/395: counsel-recentf: Sort by access time when including XDG list. |
Date: |
Thu, 25 Feb 2021 08:31:44 -0500 (EST) |
branch: externals/ivy-hydra
commit a1598100ce063cdf72b3de9ad4945ea8503b5133
Author: dude <ej32u@protonmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
counsel-recentf: Sort by access time when including XDG list.
To interleave the XDG list and Emacs's `recentf-list`, sort the combined
list by
access time using the `file-attributes` function.
Another approach would be to sort by modification time with
`file-newer-than-file-p`, but since not all viewed files are modified,
access
time is probably the better choice.
Edit doc strings to better compy with checkdoc test.
Fixes #2423
---
counsel.el | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/counsel.el b/counsel.el
index f681510..bf17bfa 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2246,13 +2246,23 @@
https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec/."
("x" counsel-find-file-extern "open externally")))
(defun counsel-recentf-candidates ()
- "Return candidates for `counsel-recentf'."
- (append (mapcar #'substring-no-properties recentf-list)
- (and counsel-recentf-include-xdg-list
- (version< "25" emacs-version)
- (counsel--recentf-get-xdg-recent-files))))
+ "Return candidates for `counsel-recentf'.
+
+When `counsel-recentf-include-xdg-list' is non-nil, also include
+the files in said list, sorting the combined list by file access
+time."
+ (if (and counsel-recentf-include-xdg-list
+ (version< "25" emacs-version))
+ (delete-dups
+ (sort (append (mapcar #'substring-no-properties recentf-list)
+ (counsel--recentf-get-xdg-recent-files))
+ (lambda (file1 file2)
+ (> (time-to-seconds (file-attribute-access-time
(file-attributes file1)))
+ (time-to-seconds (file-attribute-access-time
(file-attributes file2)))))))
+ (mapcar #'substring-no-properties recentf-list)))
(defun counsel--strip-prefix (prefix str)
+ "Strip PREFIX from STR."
(let ((l (length prefix)))
(when (string= (substring str 0 l) prefix)
(substring str l))))
@@ -2268,7 +2278,7 @@ Requires Emacs 25.
It searches for the file \"recently-used.xbel\" which lists files
and directories, in the directory returned by the function
-`xdg-data-home'. This file is processed using functionality
+`xdg-data-home'. This file is processed using functionality
provided by the libxml2 bindings and the \"dom\" library."
(require 'dom)
(let ((file-of-recent-files
- [elpa] externals/ivy-hydra 3e281d0 315/395: ivy-test.el (counsel-find-file-single-match-directories): Add test, (continued)
- [elpa] externals/ivy-hydra 3e281d0 315/395: ivy-test.el (counsel-find-file-single-match-directories): Add test, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d3e14db 303/395: ivy.el (ivy--call-marked): Fix :multi-action with alist collection, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 031ed58 331/395: ivy.el (ivy-call): Remove redundant cond branch, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 453f510 306/395: * ivy-test.el (ivy-avy): Fix skip condition., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1bf7f91 018/395: counsel.el (counsel--preselect-file): Do not pre-select URL., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 256deea 019/395: swiper.el (swiper--isearch-format): Prepend swiper-line-face property, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 249ccc6 041/395: ivy.el (ivy--split): Re-write, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 69dbbf6 056/395: ivy.el (ivy--tramp-candidates): Extract, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 95d557b 070/395: swiper.el (swiper-query-replace): Add a more straightforward default, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra e3fc84f 104/395: counsel.el (counsel--git-grep-occur-cmd): Simplify, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a159810 120/395: counsel-recentf: Sort by access time when including XDG list.,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 8dba6ff 115/395: ivy-test.el (swiper-query-replace): Add test, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra aefd669 114/395: swiper.el (swiper-query-replace): Fix for ivy--regex-ignore-order, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 9fd766d 122/395: counsel.el (counsel-evil-register-face): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 47bd7b1 119/395: Handle case correctly in `counsel-grep-like-occur', Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra e860b11 116/395: ivy.el (ivy--resize-minibuffer-to-fit): Fix "M-o" not showing the list of actions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 068ed9c 131/395: counsel-kmacro: Clarify Emacs's behavior regarding counter initial values., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 56807a1 134/395: counsel.el (counsel-recentf): Add "d" action, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7084d60 154/395: counsel.el (counsel-cd): Default to the directory of the current buffer, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra fcf5dcf 159/395: ivy.el (ivy--compute-extra-actions): Use the provided doc for "o", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra e7cc776 174/395: swiper.el (swiper-verbose): New defcustom, Basil L. Contovounesios, 2021/02/25