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: Nathan Neff
Subject: Re: [O] Agenda: Display projects and 3 todo subtasks
Date: Thu, 8 Aug 2019 14:05:57 -0500

Wow - thanks Adam!

Your stuff is awesome.  org-rifle is incredible.  (I just wish that
it didn't have as many dependencies -- I guess I'm just a bit paranoid).

Thanks,
--Nate


On Thu, Aug 8, 2019 at 10:48 AM Adam Porter <address@hidden> wrote:
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]