From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: Re: Help with "macro"
Date: Sat, 12 Oct 2019 15:16:14 -0500 [thread overview]
Message-ID: <87k199n2i9.fsf@alphapapa.net> (raw)
In-Reply-To: CAC=HedBW4Qs7nNdmzhv1HY-bo2mn0Rd2s6y8N08cKNDB1MiLyg@mail.gmail.com
Nathan Neff <nathan.neff@gmail.com> 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))))
prev parent reply other threads:[~2019-10-12 20:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 16:18 Help with "macro" Nathan Neff
2019-10-12 19:04 ` Nathan Neff
2019-10-12 20:16 ` Adam Porter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k199n2i9.fsf@alphapapa.net \
--to=adam@alphapapa.net \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).