You can customize skipping specific entries in org-agenda
by using a skip function. This is a function (or lisp form) that will be evaluated at each headline and should return nil
(to not skip the headline) or the point of the next headline to consider (which is typically the next headline, but could be, for example the next sibling to speed the search up).
In this case, we just need a function to skip the headline if it has a certain tag (get those with org-get-tags-at
) and the (current-time)
is after a certain hour:
(defun skip-tag-after (tag hour)
(let* ((next-headline (save-excursion
(or (outline-next-heading) (point-max))))
(current-headline (or (and (org-at-heading-p)
(point))
(save-excursion (org-back-to-heading))))
;; (now (decode-time (current-time)))
(target (decode-time (current-time)))
(day (nth 6 target))
)
(setcar (last target 7) hour)
(setcar (last target 8) 0)
(if (and (member tag (org-get-tags-at current-headline))
(or (eq day 0)
(eq day 6)
(time-less-p (apply #'encode-time target) (current-time))))
next-headline
nil)))
This doesn't consider the weekday, but that logic
You can either (setq (setq org-agenda-skip-function-global '(skip-tag-after "WORK" 17))
to skip such headlines globally in every agenda, or set it set org-agenda-skip-function
locally inside a org-agenda-custom-command
to affect just that agenda.
org-agenda-skip-function
. Also, please specify which of the the three (3) main functions you are relying upon --org-agenda-list
,org-search-view
, ororg-tags-view
.