Is it possible to hide items with a certain tag after at specific time of the day? For example, I'd like that after 5pm and on weekends, :WORK: items don't appear in the agenda.

EDIT: I am dealing with scheduled items and relying on org-agenda-list function.

  • Yes, but it will be a little slow if you have lots of deadlines and/or scheduled. Please edit your post (or add a comment) to specify whether you are dealing with deadlines or scheduled, and if both, which one you want to evaluate. In my mind, I am thinking of a custom 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, or org-tags-view.
    – lawlist
    Jan 19, 2016 at 7:47

2 Answers 2


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)
                              (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))))

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.

  • What if I have several such tags: one is for working-time, another is for evenings 7 days a week, etc? How do I combine filtering on all of them? Nov 11, 2017 at 16:01
  • You can use a lisp form as the value of org-agenda-skip-function by for example setting it to (or (skip-tags-after "WORK" 17) (skip-tags-after "HOME" 9))
    – erikstokes
    Nov 11, 2017 at 20:21

A very simple workaround would would be to make a special agenda view (or views) that you only use on evenings and weekends.

To give a very simple example, you could customize org-agenda-custom-commands by adding something like ("x" "No Work" tags-todo "-work" nil). Then on evenings and weekends you can pull up your overall agenda view with C-c a x.

  • This is my current setup and it works but I was considering an alternative. Jan 20, 2016 at 0:11
  • 2
    org-agenda-custom-commands also allows you to set custom functions... It should definitely be possible to do what you want that way (a simple if) , but I don't know elisp well enough to show you how exactly.
    – Brian Z
    Jan 20, 2016 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.