emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Agenda: Display projects and 3 todo subtasks
@ 2019-07-31  2:32 Nathan Neff
  2019-07-31  2:36 ` Nathan Neff
  2019-08-08 15:48 ` Adam Porter
  0 siblings, 2 replies; 8+ messages in thread
From: Nathan Neff @ 2019-07-31  2:32 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]

Hello all,

I found this cool snippet at Sacha Chua's website: [1].

It creates an agenda view with headings marked with tag "project",
and for each of those headings, it displays up to 3 sub headings marked
TODO.

I like this idea of seeing my projects (plus a few TODO entries under each
project)
in the agenda is a cool idea, so I copy/pasted the snippet at [1].

I created an example org file:
* Project 1                                                    :PROJECT:
** todo task 1.1
** todo task 1.2
** todo task 1.3
** todo task 1.4
* Project 2                                                    :PROJECT:
** todo task 2.1
** todo task 2.2
** todo task 2.3
** todo task 2.4

And ran the custom agenda command on only that file.

The output which is produced lists each project correctly.
However the sub-tasks under each project are the *same 3 subtasks*
from Project 1

  foo:        Project 1
  foo:        todo task 1.1
  foo:        todo task 1.2
  foo:        todo task 1.3
  foo:        Project 2
  foo:        todo task 1.1
  foo:        todo task 1.2
  foo:        todo task 1.3

The snippet at [1] is a bit more complex than I thought would be necessary
for such
an agenda view.  Does someone have any snippets or suggestions for how to
accomplish the idea above?  Is there something obvious that I'm missing
about
the setup of my test org file?

Thanks,
--Nate

[1]
https://github.com/sachac/.emacs.d/blob/gh-pages/Sacha.org#display-projects-with-associated-subtasks
The associated blog entry is:
https://sachachua.com/blog/2013/01/emacs-org-display-projects-with-a-few-subtasks-in-the-agenda-view/

[-- Attachment #2: Type: text/html, Size: 2701 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Agenda: Display projects and 3 todo subtasks
  2019-07-31  2:32 Agenda: Display projects and 3 todo subtasks Nathan Neff
@ 2019-07-31  2:36 ` Nathan Neff
  2019-07-31 13:59   ` Sacha Chua
  2019-08-08 15:48 ` Adam Porter
  1 sibling, 1 reply; 8+ messages in thread
From: Nathan Neff @ 2019-07-31  2:36 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]

I forgot to mention that I have PROJECT tag as not inheritable:
(setq org-tags-exclude-from-inheritance (quote ("PROJECT")))

And here's the agenda custom-command addition:
 ("2" "List projects with tasks" my/org-agenda-projects-and-tasks
         "+PROJECT"
         ((org-agenda-max-entries 3))



On Tue, Jul 30, 2019 at 9:32 PM Nathan Neff <nathan.neff@gmail.com> wrote:

> Hello all,
>
> I found this cool snippet at Sacha Chua's website: [1].
>
> It creates an agenda view with headings marked with tag "project",
> and for each of those headings, it displays up to 3 sub headings marked
> TODO.
>
> I like this idea of seeing my projects (plus a few TODO entries under each
> project)
> in the agenda is a cool idea, so I copy/pasted the snippet at [1].
>
> I created an example org file:
> * Project 1                                                    :PROJECT:
> ** todo task 1.1
> ** todo task 1.2
> ** todo task 1.3
> ** todo task 1.4
> * Project 2                                                    :PROJECT:
> ** todo task 2.1
> ** todo task 2.2
> ** todo task 2.3
> ** todo task 2.4
>
> And ran the custom agenda command on only that file.
>
> The output which is produced lists each project correctly.
> However the sub-tasks under each project are the *same 3 subtasks*
> from Project 1
>
>   foo:        Project 1
>   foo:        todo task 1.1
>   foo:        todo task 1.2
>   foo:        todo task 1.3
>   foo:        Project 2
>   foo:        todo task 1.1
>   foo:        todo task 1.2
>   foo:        todo task 1.3
>
> The snippet at [1] is a bit more complex than I thought would be necessary
> for such
> an agenda view.  Does someone have any snippets or suggestions for how to
> accomplish the idea above?  Is there something obvious that I'm missing
> about
> the setup of my test org file?
>
> Thanks,
> --Nate
>
> [1]
> https://github.com/sachac/.emacs.d/blob/gh-pages/Sacha.org#display-projects-with-associated-subtasks
> The associated blog entry is:
>
> https://sachachua.com/blog/2013/01/emacs-org-display-projects-with-a-few-subtasks-in-the-agenda-view/
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 3693 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Agenda: Display projects and 3 todo subtasks
  2019-07-31  2:36 ` Nathan Neff
@ 2019-07-31 13:59   ` Sacha Chua
       [not found]     ` <CAC=HedC2ca+5zS2kSVaLRFm556z_7+Va3Ymki_D46P_FOKUXMQ@mail.gmail.com>
  2019-08-23 18:58     ` Nathan Neff
  0 siblings, 2 replies; 8+ messages in thread
From: Sacha Chua @ 2019-07-31 13:59 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs list

[-- Attachment #1: Type: text/plain, Size: 2514 bytes --]

Hmm, you're right, that project subtask snippet isn't working any more. I
don't think I can sort that out while I'm away from my computer, so it may
take me a few weeks until I can poke around. If anyone happens to have a
better config, please feel free to share!

On Wed., Jul. 31, 2019, 10:37 Nathan Neff, <nathan.neff@gmail.com> wrote:

> I forgot to mention that I have PROJECT tag as not inheritable:
> (setq org-tags-exclude-from-inheritance (quote ("PROJECT")))
>
> And here's the agenda custom-command addition:
>  ("2" "List projects with tasks" my/org-agenda-projects-and-tasks
>          "+PROJECT"
>          ((org-agenda-max-entries 3))
>
>
>
> On Tue, Jul 30, 2019 at 9:32 PM Nathan Neff <nathan.neff@gmail.com> wrote:
>
>> Hello all,
>>
>> I found this cool snippet at Sacha Chua's website: [1].
>>
>> It creates an agenda view with headings marked with tag "project",
>> and for each of those headings, it displays up to 3 sub headings marked
>> TODO.
>>
>> I like this idea of seeing my projects (plus a few TODO entries under
>> each project)
>> in the agenda is a cool idea, so I copy/pasted the snippet at [1].
>>
>> I created an example org file:
>> * Project 1                                                    :PROJECT:
>> ** todo task 1.1
>> ** todo task 1.2
>> ** todo task 1.3
>> ** todo task 1.4
>> * Project 2                                                    :PROJECT:
>> ** todo task 2.1
>> ** todo task 2.2
>> ** todo task 2.3
>> ** todo task 2.4
>>
>> And ran the custom agenda command on only that file.
>>
>> The output which is produced lists each project correctly.
>> However the sub-tasks under each project are the *same 3 subtasks*
>> from Project 1
>>
>>   foo:        Project 1
>>   foo:        todo task 1.1
>>   foo:        todo task 1.2
>>   foo:        todo task 1.3
>>   foo:        Project 2
>>   foo:        todo task 1.1
>>   foo:        todo task 1.2
>>   foo:        todo task 1.3
>>
>> The snippet at [1] is a bit more complex than I thought would be
>> necessary for such
>> an agenda view.  Does someone have any snippets or suggestions for how to
>> accomplish the idea above?  Is there something obvious that I'm missing
>> about
>> the setup of my test org file?
>>
>> Thanks,
>> --Nate
>>
>> [1]
>> https://github.com/sachac/.emacs.d/blob/gh-pages/Sacha.org#display-projects-with-associated-subtasks
>> The associated blog entry is:
>>
>> https://sachachua.com/blog/2013/01/emacs-org-display-projects-with-a-few-subtasks-in-the-agenda-view/
>>
>>
>>
>>

[-- Attachment #2: Type: text/html, Size: 4462 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Agenda: Display projects and 3 todo subtasks
       [not found]     ` <CAC=HedC2ca+5zS2kSVaLRFm556z_7+Va3Ymki_D46P_FOKUXMQ@mail.gmail.com>
@ 2019-08-01 21:48       ` Nathan Neff
  0 siblings, 0 replies; 8+ messages in thread
From: Nathan Neff @ 2019-08-01 21:48 UTC (permalink / raw)
  To: Sacha Chua, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3126 bytes --]

Wow, cool to hear from the one & only Sacha!

Also, I found this GTD blog which appears to have something similar, under
the "Filtering Projects and Actions" section:
https://emacs.cafe/emacs/orgmode/gtd/2017/06/30/orgmode-gtd.html

However, this  mechanism seems to report only the first TODO action
which is tagged with "@office" and (I presume) assumes that any headline
tagged @office is a "project".

Also, after reviewing Bernt Hansen's org-mode setup, it appears that
he uses NEXT keyword to distinguish between tasks that need to be done
(TODO) and tasks that can be accomplished NEXT.  This may obviate
the need to show the first X items of any given project.

So many options  . . . . . .

Thanks,
--Nate


>
>
>
>> On Wed., Jul. 31, 2019, 10:37 Nathan Neff, <nathan.neff@gmail.com> wrote:
>>
>>> I forgot to mention that I have PROJECT tag as not inheritable:
>>> (setq org-tags-exclude-from-inheritance (quote ("PROJECT")))
>>>
>>> And here's the agenda custom-command addition:
>>>  ("2" "List projects with tasks" my/org-agenda-projects-and-tasks
>>>          "+PROJECT"
>>>          ((org-agenda-max-entries 3))
>>>
>>>
>>>
>>> On Tue, Jul 30, 2019 at 9:32 PM Nathan Neff <nathan.neff@gmail.com>
>>> wrote:
>>>
>>>> Hello all,
>>>>
>>>> I found this cool snippet at Sacha Chua's website: [1].
>>>>
>>>> It creates an agenda view with headings marked with tag "project",
>>>> and for each of those headings, it displays up to 3 sub headings marked
>>>> TODO.
>>>>
>>>> I like this idea of seeing my projects (plus a few TODO entries under
>>>> each project)
>>>> in the agenda is a cool idea, so I copy/pasted the snippet at [1].
>>>>
>>>> I created an example org file:
>>>> * Project 1                                                    :PROJECT:
>>>> ** todo task 1.1
>>>> ** todo task 1.2
>>>> ** todo task 1.3
>>>> ** todo task 1.4
>>>> * Project 2                                                    :PROJECT:
>>>> ** todo task 2.1
>>>> ** todo task 2.2
>>>> ** todo task 2.3
>>>> ** todo task 2.4
>>>>
>>>> And ran the custom agenda command on only that file.
>>>>
>>>> The output which is produced lists each project correctly.
>>>> However the sub-tasks under each project are the *same 3 subtasks*
>>>> from Project 1
>>>>
>>>>   foo:        Project 1
>>>>   foo:        todo task 1.1
>>>>   foo:        todo task 1.2
>>>>   foo:        todo task 1.3
>>>>   foo:        Project 2
>>>>   foo:        todo task 1.1
>>>>   foo:        todo task 1.2
>>>>   foo:        todo task 1.3
>>>>
>>>> The snippet at [1] is a bit more complex than I thought would be
>>>> necessary for such
>>>> an agenda view.  Does someone have any snippets or suggestions for how
>>>> to
>>>> accomplish the idea above?  Is there something obvious that I'm missing
>>>> about
>>>> the setup of my test org file?
>>>>
>>>> Thanks,
>>>> --Nate
>>>>
>>>> [1]
>>>> https://github.com/sachac/.emacs.d/blob/gh-pages/Sacha.org#display-projects-with-associated-subtasks
>>>> The associated blog entry is:
>>>>
>>>> https://sachachua.com/blog/2013/01/emacs-org-display-projects-with-a-few-subtasks-in-the-agenda-view/
>>>>
>>>>
>>>>
>>>>

[-- Attachment #2: Type: text/html, Size: 5888 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Agenda: Display projects and 3 todo subtasks
  2019-07-31  2:32 Agenda: Display projects and 3 todo subtasks Nathan Neff
  2019-07-31  2:36 ` Nathan Neff
@ 2019-08-08 15:48 ` Adam Porter
  2019-08-08 19:05   ` Nathan Neff
  1 sibling, 1 reply; 8+ messages in thread
From: Adam Porter @ 2019-08-08 15:48 UTC (permalink / raw)
  To: emacs-orgmode

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Agenda: Display projects and 3 todo subtasks
  2019-08-08 15:48 ` Adam Porter
@ 2019-08-08 19:05   ` Nathan Neff
  2019-08-09 11:03     ` Adam Porter
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Neff @ 2019-08-08 19:05 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]

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 <adam@alphapapa.net> 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.
>
>
>

[-- Attachment #2: Type: text/html, Size: 3202 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Agenda: Display projects and 3 todo subtasks
  2019-08-08 19:05   ` Nathan Neff
@ 2019-08-09 11:03     ` Adam Porter
  0 siblings, 0 replies; 8+ messages in thread
From: Adam Porter @ 2019-08-09 11:03 UTC (permalink / raw)
  To: emacs-orgmode

Nathan Neff <nathan.neff@gmail.com> writes:

> 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 for the kind words.

Which dependencies concern you?  helm-org-rifle uses:

-  Helm, of course.  However it has non-Helm commands built in, so you
   don't have to actually use Helm, and merely having it installed does
   nothing.  In the future I plan to refactor to put the Helm commands
   into a separate package.

-  dash.el, which is a very widely used package.

-  s.el, which is also widely used.

-  And f.el, which is also a commonly used convenience package.

If you're concerned about package updates breaking functionality or
causing vulnerabilities, I share that concern to some extent, and that's
why I don't recommend upgrading packages en masse.  I keep installed
packages in git as part of my Emacs config, and I update individual
packages when necessary.

BTW, have you tried the package org-recent-headings?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Agenda: Display projects and 3 todo subtasks
  2019-07-31 13:59   ` Sacha Chua
       [not found]     ` <CAC=HedC2ca+5zS2kSVaLRFm556z_7+Va3Ymki_D46P_FOKUXMQ@mail.gmail.com>
@ 2019-08-23 18:58     ` Nathan Neff
  1 sibling, 0 replies; 8+ messages in thread
From: Nathan Neff @ 2019-08-23 18:58 UTC (permalink / raw)
  To: Sacha Chua; +Cc: emacs list

[-- Attachment #1: Type: text/plain, Size: 3182 bytes --]

I ran into another possible solution for the request of seeing the first
X TODO tasks for a project in the Agenda:

Let's say I simply run an org-tags-todo query looking for :project:

The Agenda now shows this:

Project1
Project2
Project3

Another possible solution would be to simply TAB to one of the projects, and
run org-todo-list with the restriction on the current subtree.

I'm trying to find a way to create a function to do this . . . . . . I guess
a macro-like function would work

Thanks,
--Nate


On Wed, Jul 31, 2019 at 8:59 AM Sacha Chua <sacha@sachachua.com> wrote:

> Hmm, you're right, that project subtask snippet isn't working any more. I
> don't think I can sort that out while I'm away from my computer, so it may
> take me a few weeks until I can poke around. If anyone happens to have a
> better config, please feel free to share!
>
> On Wed., Jul. 31, 2019, 10:37 Nathan Neff, <nathan.neff@gmail.com> wrote:
>
>> I forgot to mention that I have PROJECT tag as not inheritable:
>> (setq org-tags-exclude-from-inheritance (quote ("PROJECT")))
>>
>> And here's the agenda custom-command addition:
>>  ("2" "List projects with tasks" my/org-agenda-projects-and-tasks
>>          "+PROJECT"
>>          ((org-agenda-max-entries 3))
>>
>>
>>
>> On Tue, Jul 30, 2019 at 9:32 PM Nathan Neff <nathan.neff@gmail.com>
>> wrote:
>>
>>> Hello all,
>>>
>>> I found this cool snippet at Sacha Chua's website: [1].
>>>
>>> It creates an agenda view with headings marked with tag "project",
>>> and for each of those headings, it displays up to 3 sub headings marked
>>> TODO.
>>>
>>> I like this idea of seeing my projects (plus a few TODO entries under
>>> each project)
>>> in the agenda is a cool idea, so I copy/pasted the snippet at [1].
>>>
>>> I created an example org file:
>>> * Project 1                                                    :PROJECT:
>>> ** todo task 1.1
>>> ** todo task 1.2
>>> ** todo task 1.3
>>> ** todo task 1.4
>>> * Project 2                                                    :PROJECT:
>>> ** todo task 2.1
>>> ** todo task 2.2
>>> ** todo task 2.3
>>> ** todo task 2.4
>>>
>>> And ran the custom agenda command on only that file.
>>>
>>> The output which is produced lists each project correctly.
>>> However the sub-tasks under each project are the *same 3 subtasks*
>>> from Project 1
>>>
>>>   foo:        Project 1
>>>   foo:        todo task 1.1
>>>   foo:        todo task 1.2
>>>   foo:        todo task 1.3
>>>   foo:        Project 2
>>>   foo:        todo task 1.1
>>>   foo:        todo task 1.2
>>>   foo:        todo task 1.3
>>>
>>> The snippet at [1] is a bit more complex than I thought would be
>>> necessary for such
>>> an agenda view.  Does someone have any snippets or suggestions for how to
>>> accomplish the idea above?  Is there something obvious that I'm missing
>>> about
>>> the setup of my test org file?
>>>
>>> Thanks,
>>> --Nate
>>>
>>> [1]
>>> https://github.com/sachac/.emacs.d/blob/gh-pages/Sacha.org#display-projects-with-associated-subtasks
>>> The associated blog entry is:
>>>
>>> https://sachachua.com/blog/2013/01/emacs-org-display-projects-with-a-few-subtasks-in-the-agenda-view/
>>>
>>>
>>>
>>>

[-- Attachment #2: Type: text/html, Size: 5653 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-23 18:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-31  2:32 Agenda: Display projects and 3 todo subtasks Nathan Neff
2019-07-31  2:36 ` Nathan Neff
2019-07-31 13:59   ` Sacha Chua
     [not found]     ` <CAC=HedC2ca+5zS2kSVaLRFm556z_7+Va3Ymki_D46P_FOKUXMQ@mail.gmail.com>
2019-08-01 21:48       ` Nathan Neff
2019-08-23 18:58     ` Nathan Neff
2019-08-08 15:48 ` Adam Porter
2019-08-08 19:05   ` Nathan Neff
2019-08-09 11:03     ` Adam Porter

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).