I'm getting there - I found (org-element-property :PROJ (org-element-at-point)) from a regular org-mode file - now I just need to jump there from the agenda. On Sat, Oct 12, 2019 at 12:18 PM Nathan Neff wrote: > 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 " or perhaps "agenda for the narrowed item" > 4) Keep the existing original agenda view (using sticky or some other > tactic). > > Here's what I have so far: > (defun njn-show-tasks-for-project() > (interactive) > ;; (setq preval org-agenda-sticky) > ;; (message "preval is: ") > (call-interactively 'org-agenda-set-restriction-lock-from-agenda) > ;; (org-toggle-sticky-agenda 't) > (setq org-agenda-buffer-name "JarJarBarBar") > (call-interactively 'org-todo-list) > ;; (org-toggle-sticky-agenda preval) > ) > > This works, but my original agenda view is updated to be restricted. > I've been tinkering with the "sticky" view for the agenda. Also, I would > like to set the name of the new buffer to either the heading which my > cursor > is on in the agenda, or perhaps a property of the heading which my cursor > is > on in the agenda. > > As you can see, I tried to set a "preval" variable to the current > stickiness of the agenda > and then reset the value after calling org-todo-list, but this has not > worked out for me so far. > > Any ideas? > > Thanks, > --Nate >