As the title. I have come so close but can't get past this last hurdle.
The below returns all time today that has been spent on headings where the tag is 'billable'. However it fails when there are also other tags. I've tried to replace string= with a test for the string containing billable, but for some reason it fails.
You can see some of my attempts commented out below.
(defun my-broken-function () (interactive) (let ((files (org-agenda-files)) (total 0)) (org-agenda-prepare-buffers files) (dolist (file files) (with-current-buffer (find-buffer-visiting file) (setq total (+ total (org-clock-sum-today (lambda () (string= (org-entry-get (point) "TAGS") ":billable:") ;; (string-match ":billable:" (org-entry-get (point) "TAGS")) ;; (not (not (string-match-p (regexp-quote "billable") (org-entry-get (point) "TAGS")))) )))))) (message (number-to-string total)) ))