emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Agenda: Display projects and 3 todo subtasks


From: Adam Porter
Subject: Re: [O] Agenda: Display projects and 3 todo subtasks
Date: Thu, 08 Aug 2019 10:48:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi Nathan,

Well, this is an unorthodox solution using org-ql, but it seems to work.
So, for what it's worth:

#+BEGIN_SRC elisp
  (let* ((sub-query (lambda ()
                      (save-excursion
                        (save-restriction
                          (cons (org-ql--add-markers 
(org-element-headline-parser (line-end-position)))
                                (-take 3 (progn
                                           (org-narrow-to-subtree)
                                           (org-ql-select nil
                                             '(todo)
                                             :narrow t
                                             :action 
'element-with-markers))))))))
         (entries (-flatten-n 1 (org-ql-select buffer
                                  '(and (tags "PROJECT")
                                        (not (todo)))
                                  :action sub-query))))
    (org-ql-agenda--agenda nil nil :entries entries))
#+END_SRC

This produces an agenda-like view showing (I changed "todo" to "TODO" in
the test file):

  Project 1                                                            :PROJECT:
  TODO task 1.1                                                        :PROJECT:
  TODO task 1.2                                                        :PROJECT:
  TODO task 1.3                                                        :PROJECT:
  Project 2                                                            :PROJECT:
  TODO task 2.1                                                        :PROJECT:
  TODO task 2.2                                                        :PROJECT:
  TODO task 2.3                                                        :PROJECT:

This is a bit awkward, but it's given me an idea about running nested
queries, so I'll see if I can make that easier.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]