Function: org-agenda-skip-if-todo

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

Signature

(org-agenda-skip-if-todo ARGS END)

Documentation

Helper function for org-agenda-skip-if, do not use it directly.

ARGS is a list with first element either todo, nottodo, todo-unblocked or nottodo-unblocked. The remainder is either a list of TODO keywords, or a state symbol todo or done or any.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-skip-if-todo (args end)
  "Helper function for `org-agenda-skip-if', do not use it directly.
ARGS is a list with first element either `todo', `nottodo',
`todo-unblocked' or `nottodo-unblocked'.  The remainder is either
a list of TODO keywords, or a state symbol `todo' or `done' or
`any'."
  (let ((todo-re
	 (concat "^\\*+[ \t]+"
		 (regexp-opt
		  (pcase args
		    (`(,_ todo)
		     (org-delete-all org-done-keywords
				     (copy-sequence org-todo-keywords-1)))
		    (`(,_ done) org-done-keywords)
		    (`(,_ any) org-todo-keywords-1)
		    (`(,_ ,(pred atom))
		     (error "Invalid TODO class or type: %S" args))
		    (`(,_ ,(pred (member "*"))) org-todo-keywords-1)
		    (`(,_ ,todo-list) todo-list))
		  'words))))
    (pcase args
      (`(todo . ,_)
       (let (case-fold-search) (re-search-forward todo-re end t)))
      (`(nottodo . ,_)
       (not (let (case-fold-search) (re-search-forward todo-re end t))))
      (`(todo-unblocked . ,_)
       (catch :unblocked
	 (while (let (case-fold-search) (re-search-forward todo-re end t))
	   (when (org-entry-blocked-p) (throw :unblocked t)))
	 nil))
      (`(nottodo-unblocked . ,_)
       (catch :unblocked
	 (while (let (case-fold-search) (re-search-forward todo-re end t))
	   (when (org-entry-blocked-p) (throw :unblocked nil)))
	 t))
      (`(,type . ,_) (error "Unknown TODO skip type: %S" type)))))