When org-agenda-follow-mode is on, how do I make the buffer showing the items in the agenda narrow to the subtree of the relevant item?
Basically all you need to do this is to have org-narrow-to-subtree
run right after whatever function org-follow-mode
is calling, which happen to be org-agenda-goto
. You have to be a little careful writing the advice because org-agenda-goto
is sometimes called with an argument, which org-narrow-to-subtree
can't take. Here's what we need:
(advice-add 'org-agenda-goto :after
(lambda (&rest args)
(org-narrow-to-subtree)))
-
Excellent snippet! Is there a way to make it follow in the same window? – Emmanuel Goldstein Nov 12 '20 at 9:26
-
Late response, but it may be helpful to someone.
There's another possibility to view tree in indirect buffer only for item at point with C-c C-x b
This indirect buffer can also be used in follow mode when you set org-agenda-follow-indirect
to non-nil value like this:
(setq org-agenda-follow-indirect t)