Skip to content

Commit

Permalink
Fix: (:ancestor-with-todo) Not an auto-group
Browse files Browse the repository at this point in the history
Accidentally added this selector as an auto-group when it should be
just a regular one.
  • Loading branch information
alphapapa committed Sep 16, 2024
1 parent 05a7100 commit d0954b8
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions org-super-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d0954b8

Please sign in to comment.