0

I have a huge org file and I use the sparse tree function a lot to help me plan my weeks/months. (The agenda mode just doesn't do it for me; I really need to see it in the context of the tree.)

Because of the file's size, running queries takes a really long time (4-5m).

Most of the tree is marked with specific tags that I can use to disregard some subtrees. The sparse function & my specific query already take tags into account. With my query, anything with those tags is not shown in the result list (the sparse tree). (An example of a tag that I believe is ignored by default is ARCHIVE.)

However, subtrees with tags that will be ignored are still traversed, so it takes the same time to run queries regardless of their tags. I'd like to change that, such that the presence of a tag in a subtree makes org-mode simply not go down that tree at all.

Is it possible?

Note that this is a performance issue. The result is (extensionally) the same; I'm just trying to make it faster.

9
  • You can use follow mode in the agenda to get both the agenda view and the in-tree context view.
    – NickD
    Jan 7, 2023 at 16:07
  • One idea would be to narrow the query to return results more quickly; e.g., a time-span related inquiry may result in a loop for each and every date within the span ... Another thing to check for would be an unrelated minor mode that may be slowing things down during the data gathering process. It might be worthwhile to run the profiler during a lengthy query to see which functions are consuming the majority of the CPU.
    – lawlist
    Jan 7, 2023 at 16:53
  • @NickD thank you. I have tried it, and just the amount of information and formatting is very overwhelming for me. I just need the tree. I actually end up printing the sparse tree to make it even easier to process for me. But thanks! :)
    – Ivan Perez
    Jan 8, 2023 at 3:45
  • 1
    I wonder if org-ql might make things easier (although I have not tried either it or the "native" methods either - caveat emptor).
    – NickD
    Jan 8, 2023 at 14:00
  • 1
    @NickD I decided to give org-ql a try and by god it is fast. It takes 1 second to produce a sparse tree (org-sparse-tree takes 4 minutes for the same query).
    – Ivan Perez
    Jan 12, 2023 at 4:02

1 Answer 1

0

Following @NickD's recommendation, I decided to use org-ql instead.

It takes 1 second to produce a query for which org-sparse-tree needs 4 minutes. I think the solution is just to use org-ql.

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.