branch: externals/disk-usage
commit 684659078d16cfcc47e311dc53cd99a01f57ebd6
Author: Pierre Neidhardt <[email protected]>
Commit: Pierre Neidhardt <[email protected]>

    Add 1-hour filter
---
 disk-usage.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/disk-usage.el b/disk-usage.el
index 1900148..22ed325 100644
--- a/disk-usage.el
+++ b/disk-usage.el
@@ -130,6 +130,16 @@
   (interactive)
   (clrhash disk-usage--cache))
 
+(defun disk-usage-filter-1-hour (_path attributes &optional seconds)
+  (if (null (file-attribute-type attributes))
+      ;; Regular files
+      (time-less-p
+       (time-since
+        (file-attribute-modification-time attributes))
+       (seconds-to-time (or seconds (* 60 60))))
+    ;; Always keep directories and symlinks.
+    t))
+
 (defun disk-usage-filter-1-day (_path attributes &optional days)
   (if (null (file-attribute-type attributes))
       ;; Regular files
@@ -156,7 +166,8 @@
 (defun disk-usage-filter-10M-size (path attributes)
   (disk-usage-filter-1M-size path attributes (* 10 1024 1024)))
 
-(defcustom disk-usage-available-filters '(disk-usage-filter-1-day
+(defcustom disk-usage-available-filters '(disk-usage-filter-1-hour
+                                          disk-usage-filter-1-day
                                           disk-usage-filter-1-week
                                           disk-usage-filter-4-week
                                           disk-usage-filter-1M-size

Reply via email to