From df7b07eff5031b4083543fbdcbf495b2ceeb7e72 Mon Sep 17 00:00:00 2001 From: Walheimat Date: Tue, 8 Oct 2024 19:51:03 +0200 Subject: [PATCH] Add :done selector Adds selector `:done` that groups items that are done according to `org-done-keywords`. --- README.org | 1 + org-super-agenda.el | 7 +++++++ org-super-agenda.info | 2 ++ 3 files changed, 10 insertions(+) diff --git a/README.org b/README.org index da5310f..125f734 100644 --- a/README.org +++ b/README.org @@ -194,6 +194,7 @@ These selectors take one argument alone, or multiple arguments in a list. + =:date= :: Group items that have a date associated. Argument can be =t= to match items with any date, =nil= to match items without a date, or =today= to match items with today’s date. The =ts-date= text-property is matched against. + =:deadline= :: Group items that have a deadline. Argument can be ~t~ (to match items with any deadline), ~nil~ (to match items that have no deadline), ~past~ (to match items with a deadline in the past), ~today~ (to match items whose deadline is today), or ~future~ (to match items with a deadline in the future). Argument may also be given like ~before DATE~ or ~after DATE~ where DATE is a date string that ~org-time-string-to-absolute~ can process. + =:effort<= :: Group items that are less than (or equal to) the given effort. Argument is a time-duration string, like ~5~ or ~0:05~ for 5 minutes. ++ =:done= :: Group items that are done according to ~org-done-keywords~. + =:effort>= :: Group items that are higher than (or equal to) the given effort. Argument is a time-duration string, like ~5~ or ~0:05~ for 5 minutes. + ~:file-path~ :: Group items whose buffers' filename paths match any of the given regular expressions. + =:habit= :: Group habit items (items which have a =STYLE: habit= Org property). diff --git a/org-super-agenda.el b/org-super-agenda.el index 01223d3..7a25971 100644 --- a/org-super-agenda.el +++ b/org-super-agenda.el @@ -778,6 +778,13 @@ keyword, or `nil' to match only non-todo items." (_ ;; Oops (user-error "Argument to `:todo' must be a string, list of strings, t, or nil")))) +(org-super-agenda--defgroup done + "Group items that are done according to `org-done-keywords'." + :section-name "Done items" + :test (org-super-agenda--when-with-marker-buffer (org-super-agenda--get-marker item) + (when-let ((state (org-get-todo-state))) + (member state org-done-keywords)))) + (org-super-agenda--defgroup ancestor-with-todo "their earliest ancestor having the to-do keyword" ;; TODO: Add tests. diff --git a/org-super-agenda.info b/org-super-agenda.info index 55128ff..3f5637d 100644 --- a/org-super-agenda.info +++ b/org-super-agenda.info @@ -422,6 +422,8 @@ list. Group items that are less than (or equal to) the given effort. Argument is a time-duration string, like ‘5’ or ‘0:05’ for 5 minutes. +‘:done’ + Group items that are done according to ‘org-done-keywords’. ‘:effort>’ Group items that are higher than (or equal to) the given effort. Argument is a time-duration string, like ‘5’ or ‘0:05’ for 5