[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Help with "macro"
From: |
Adam Porter |
Subject: |
Re: [O] Help with "macro" |
Date: |
Sat, 12 Oct 2019 15:16:14 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Nathan Neff <address@hidden> writes:
> I'm trying to implement a function to display the TODO items of the
> currently highlighted item in the agenda and have a few questions:
>
> Goal:
>
> 1) From the agenda, place the cursor on a heading.
>
> 2) Press a key and instantly narrow the agenda to the heading which
> the cursor is on.
>
> 3) Display org-todo-list for the "narrowed" item in a new buffer, with
> the name "agenda for <heading name>" or perhaps "agenda for <property
> "PROP" of the narrowed item"
>
> 4) Keep the existing original agenda view (using sticky or some other
> tactic).
Agenda restrictions are awkward to work with. I recommend using org-ql
for this sort of thing, since it's designed to do things like this.
This seems to work:
(defun nn/agenda-item-todos ()
(interactive)
(org-with-point-at (org-get-at-bol 'org-marker)
(save-restriction
(org-narrow-to-subtree)
(org-ql-search (current-buffer)
'(todo)
:narrow t))))