From d0954b8e7780a4efe49ab32fc11941db21c22bfd Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Mon, 16 Sep 2024 12:53:10 -0500 Subject: [PATCH] Fix: (:ancestor-with-todo) Not an auto-group Accidentally added this selector as an auto-group when it should be just a regular one. --- org-super-agenda.el | 63 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/org-super-agenda.el b/org-super-agenda.el index a4160b1..01223d3 100644 --- a/org-super-agenda.el +++ b/org-super-agenda.el @@ -778,6 +778,37 @@ 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 ancestor-with-todo + "their earliest ancestor having the to-do keyword" + ;; TODO: Add tests. + ;; FIXME: It's very awkward that for a single argument `args' is + ;; that argument, while multiple ones are provided as a list. + :section-name (let ((keyword (cl-typecase (car args) + (atom (car args)) + (cons (caar args)))) + (prefix (if (cl-typecase (car args) + (cons (plist-get (cdar args) :nearestp))) + "Nearest" + "Ancestor"))) + (format "%s: %s" prefix keyword)) + :test (let ((keyword (cl-typecase (car args) + (atom (car args)) + (cons (caar args)))) + (limit (cl-typecase (car args) + (cons (plist-get (cdar args) :limit)))) + (nearestp (cl-typecase (car args) + (cons (plist-get (cdar args) :nearestp))))) + (org-super-agenda--when-with-marker-buffer (org-super-agenda--get-marker item) + (cl-loop with ancestor + while (and (or (not limit) + (natnump (cl-decf limit))) + (org-up-heading-safe)) + when (equal keyword (org-get-todo-state)) + do (setf ancestor (org-entry-get nil "ITEM")) + when (and nearestp ancestor) + return ancestor + finally return ancestor)))) + ;;;;; Priority (org-super-agenda--defgroup priority @@ -1092,38 +1123,6 @@ key and as the header for its group." (when (org-up-heading-safe) (org-entry-get nil "ITEM")))) -(org-super-agenda--def-auto-group ancestor-with-todo - "their earliest ancestor having the to-do keyword" - ;; TODO: Add tests. - :keyword :ancestor-with-todo - ;; FIXME: It's very awkward that for a single argument `args' is - ;; that argument, while multiple ones are provided as a list. - :key-form (let* ((keyword (cl-typecase (car args) - (atom (car args)) - (cons (caar args)))) - (limit (cl-typecase (car args) - (cons (plist-get (cdar args) :limit)))) - (nearestp (cl-typecase (car args) - (cons (plist-get (cdar args) :nearestp))))) - (org-super-agenda--when-with-marker-buffer (org-super-agenda--get-marker item) - (cl-loop with ancestor - while (and (or (not limit) - (natnump (cl-decf limit))) - (org-up-heading-safe)) - when (equal keyword (org-get-todo-state)) - do (setf ancestor (org-entry-get nil "ITEM")) - when (and nearestp ancestor) - return ancestor - finally return ancestor))) - :header-form (let ((keyword (cl-typecase (car args) - (atom (car args)) - (cons (caar args)))) - (prefix (if (cl-typecase (car args) - (cons (plist-get (cdar args) :nearestp))) - "Nearest" - "Ancestor"))) - (format "%s %s: %s" prefix keyword key))) - ;;;;; Dispatchers (defun org-super-agenda--get-selector-fn (selector)