Function: org-agenda-skip-if

org-agenda-skip-if is a byte-compiled function defined in org-agenda.el.gz.

Signature

(org-agenda-skip-if SUBTREE CONDITIONS)

Documentation

Check current entity for CONDITIONS.

If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only the entry (i.e. the text before the next heading) is checked.

CONDITIONS is a list of symbols, boolean OR is used to combine the results from different tests. Valid conditions are:

scheduled Check if there is a scheduled cookie
notscheduled Check if there is no scheduled cookie
deadline Check if there is a deadline
notdeadline Check if there is no deadline
timestamp Check if there is a timestamp (also deadline or scheduled)
nottimestamp Check if there is no timestamp (also deadline or scheduled)
regexp Check if regexp matches
notregexp Check if regexp does not match.
todo Check if TODO keyword matches
nottodo Check if TODO keyword does not match

The regexp is taken from the conditions list, and must come right after the regexp or notregexp element.

todo and nottodo accept as an argument a list of todo keywords, which may include "*" to match any todo keyword.

    (org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))

would skip all entries with "TODO" or "WAITING" keywords.

Instead of a list, a keyword class may be given. For example:

    (org-agenda-skip-entry-if 'nottodo 'done)

would skip entries that haven't been marked with any of "DONE" keywords. Possible classes are: todo, done, any.

If any of these conditions is met, this function returns the end point of the entity, causing the search to continue from there. This is a function that can be put into org-agenda-skip-function for the duration of a command.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-skip-if (subtree conditions)
  "Check current entity for CONDITIONS.
If SUBTREE is non-nil, the entire subtree is checked.  Otherwise, only
the entry (i.e. the text before the next heading) is checked.

CONDITIONS is a list of symbols, boolean OR is used to combine the results
from different tests.  Valid conditions are:

scheduled     Check if there is a scheduled cookie
notscheduled  Check if there is no scheduled cookie
deadline      Check if there is a deadline
notdeadline   Check if there is no deadline
timestamp     Check if there is a timestamp (also deadline or scheduled)
nottimestamp  Check if there is no timestamp (also deadline or scheduled)
regexp        Check if regexp matches
notregexp     Check if regexp does not match.
todo          Check if TODO keyword matches
nottodo       Check if TODO keyword does not match

The regexp is taken from the conditions list, and must come right
after the `regexp' or `notregexp' element.

`todo' and `nottodo' accept as an argument a list of todo
keywords, which may include \"*\" to match any todo keyword.

    (org-agenda-skip-entry-if \\='todo \\='(\"TODO\" \"WAITING\"))

would skip all entries with \"TODO\" or \"WAITING\" keywords.

Instead of a list, a keyword class may be given.  For example:

    (org-agenda-skip-entry-if \\='nottodo \\='done)

would skip entries that haven't been marked with any of \"DONE\"
keywords.  Possible classes are: `todo', `done', `any'.

If any of these conditions is met, this function returns the end point of
the entity, causing the search to continue from there.  This is a function
that can be put into `org-agenda-skip-function' for the duration of a command."
  (org-back-to-heading t)
  (let* (;; (beg (point))
	 (end (if subtree (save-excursion (org-end-of-subtree t) (point))
		(org-entry-end-position)))
	 (planning-end (if subtree end (line-end-position 2)))
	 m)
    (and
     (or (and (memq 'scheduled conditions)
	      (re-search-forward org-scheduled-time-regexp planning-end t))
	 (and (memq 'notscheduled conditions)
	      (not
	       (save-excursion
		 (re-search-forward org-scheduled-time-regexp planning-end t))))
	 (and (memq 'deadline conditions)
	      (re-search-forward org-deadline-time-regexp planning-end t))
	 (and (memq 'notdeadline conditions)
	      (not
	       (save-excursion
		 (re-search-forward org-deadline-time-regexp planning-end t))))
	 (and (memq 'timestamp conditions)
	      (re-search-forward org-ts-regexp end t))
	 (and (memq 'nottimestamp conditions)
	      (not (save-excursion (re-search-forward org-ts-regexp end t))))
	 (and (setq m (memq 'regexp conditions))
	      (stringp (nth 1 m))
	      (re-search-forward (nth 1 m) end t))
	 (and (setq m (memq 'notregexp conditions))
	      (stringp (nth 1 m))
	      (not (save-excursion (re-search-forward (nth 1 m) end t))))
	 (and (or
	       (setq m (memq 'nottodo conditions))
	       (setq m (memq 'todo-unblocked conditions))
	       (setq m (memq 'nottodo-unblocked conditions))
	       (setq m (memq 'todo conditions)))
	      (org-agenda-skip-if-todo m end)))
     end)))