I'd like to list tasks done with their parent org hierarchy (projects/purposes). In my setup, the level 2 tasks are the projects. Under each project, I have org subheadings as tasks for the project. So I wonder if there is already available implementation to achieve that, or there is some similar logic that I can borrow from?

Essentially, it will do like the code for agenda views, to scan the files in org-agenda-files, but keep the parent context for those DONE tasks, and present the found tasks with its top-level 2 headings. So far, it seems to me that the implementation of the agenda views will only show the tasks themselves, without context.

I've searched here but haven't found a clue that shows how to have the parent heading of a task in the filter/scan.

Alternatively, I might do a work-around to list the top-level "project" headings with subtasks that have been done. I guess that this is doable.

Then it would serve my purpose to list those done tasks by combining the view of the project list with tasks done, and the view of the done tasks, arranging them in the proper project hierarchy.

So the more fundamental requirement is to present the tasks in a hierarchy (sparse-tree?).

Based on the concept of sparse tree, the requirements may be transformed as: to show the sparse-tree of the DONE tasks with its respective project headings

Update 1:

Based on my research it is not yet possible to show sparse-tree in agenda view across multiple org agenda files as the question: Display multi-file org agenda as a sparse tree?

The work-around, for now, is to have all the org headings that I care for sparse-tree in one file, perform a sparse-tree search there with command C-c /

Update 2:

Based on @Hubisan's suggestion, I ended up adopting the following solution (right align at the 30 space characters if the bread-crumb is less than 30 characters):

(setq org-agenda-prefix-format '((todo . "%-30b") (tags . "%-30b") (agenda . "%-30b"))

Here is the output:

Worship->Fellowship->         DONE Arrange the Zoom or Google hangout for bible pre-study
Job->DR->                     TODO [#A] Arrange the disposal at W20/train control room
Job->DSS->                    TODO Study the feasibility of fanless treatment with LCD monitors

It's good enough for my purpose.

  • 1
    You can modify the variable org-agenda-prefix-format to show breadcrumbs (higher level headings) by adding %b in agenda, todo, tags and search. For instance (agenda . " %i %-12:c%?-12t% s%b "). Have not found any other way to really customize the agenda output.
    – Hubisan
    Oct 26, 2019 at 21:22
  • Please post your update 2 as answer and accept it.
    – Hubisan
    Oct 28, 2019 at 10:17
  • 1
    You may find the org-ql package useful.
    – user3871
    Oct 28, 2019 at 18:22


Your Answer

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

Browse other questions tagged or ask your own question.