Skip to content

Instantly share code, notes, and snippets.

@colonelpanic8
Created September 13, 2023 23:13
Show Gist options
  • Select an option

  • Save colonelpanic8/c1153efb9838529fcdc36833b1ab6500 to your computer and use it in GitHub Desktop.

Select an option

Save colonelpanic8/c1153efb9838529fcdc36833b1ab6500 to your computer and use it in GitHub Desktop.
From 0b250f541fcad1fdce122ebb920188d8890f2c25 Mon Sep 17 00:00:00 2001
From: Ivan Malison <IvanMalison@gmail.com>
Date: Wed, 13 Sep 2023 16:55:30 -0600
Subject: [PATCH] Allow additional filtering on states
---
lisp/org-agenda.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 77e280be2..336829b24 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6151,6 +6151,10 @@ then those holidays will be skipped."
(delq nil (mapcar (lambda(g) (member g skip-weeks)) h))))
entry)))
+(defvar org-agenda-states-filter 'org-agenda-states-filter)
+(defun org-agenda-states-filter (state)
+ (member state org-done-keywords-for-agenda))
+
(defalias 'org-get-closed #'org-agenda-get-progress)
(defun org-agenda-get-progress ()
"Return the logged TODO entries for agenda display."
@@ -6208,6 +6212,7 @@ then those holidays will be skipped."
;; substring should only run to end of time stamp
(setq rest (substring timestr (match-end 0))
timestr (substring timestr 0 (match-end 0)))
+
(if (and (not closedp) (not statep)
(string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*?\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)"
rest))
@@ -6264,7 +6269,11 @@ then those holidays will be skipped."
'effort effort 'effort-minutes effort-minutes
'type type 'date date
'undone-face 'org-warning 'done-face 'org-agenda-done)
- (push txt ee))
+ (when (or
+ (null statep)
+ (null org-agenda-states-filter)
+ (funcall org-agenda-states-filter state marker))
+ (push txt ee)))
(goto-char (line-end-position))))
(nreverse ee)))
--
2.32.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment