Running a fresh Emacs session with emacs -Q, I evaluated the following:

(setq org-agenda-files '("~/index.org"))
(setq org-enforce-todo-dependencies t)
(setq org-agenda-dim-blocked-tasks 'invisible)

where ~/index.org simply contains:

* Project heading
  :ORDERED:  t
** TODO First subheading
** TODO Second subheading

When I call (org-agenda nil "t") to display the available TODOs, it correctly displays only "First subheading." However, if I then export that buffer with org-agenda-write, then the resulting file contains both "First subheading" and "Second subheading."

What is going on here, and can it be fixed?


The blocked entries are present in the agenda. It's just that they're invisible.

A work-around would be to not set blocked tasks to invisible. Instead, create an org-agenda-custom-command with a non-standard skip-function that actually filters out blocked entries:

("s" "Describe command here" todo "TODO"
  (function my-org-agenda-skip-blocked))))


(defun my-org-agenda-skip-blocked ()
  "Skip blocked entries"
  (let ((heading-end (save-excursion (outline-next-heading))))
    (if (org-entry-blocked-p)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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