I would like to iterate all entries from all org-agenda files but those marked as done and those currently clocked.

So far, I had success with the first part. However seems like org-agenda-skip-if can't detect if an entry is currently clocked.

Right now, what I'm doing to check if the entry is currently clocked is doing a hackish string comparison with the value of org-clock-current-task

Here is the code I have:

 ;; This goes inside a let statement which sets the org-agenda-skip-function
 ;; variable with my function to ignore DONE tasks.
(let* ((entries (org-agenda-get-day-entries file today :scheduled :deadline)))
          (dolist (entry entries)
            (if (and (string-match-p today-regexp (get-text-property 0 'extra entry))
                   (string-empty-p (get-text-property 0 'time entry))
                   (not (string-suffix-p org-clock-current-task (get-text-property 0 'txt entry))))
                (alert "Pending Task for today with unknown time of day"
                       :title (format "%s" (get-text-property 0 'txt entry))
                       :mode 'org-mode)))) 
  • 1
    IIUC, there can be at most one entry that is currently clocked, right? – NickD Aug 14 '17 at 2:08
  • yes, only one entry at the same time – shackra Aug 14 '17 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.