Home - Blog - Wiki -

A small, but useful org-agenda tweak

For the longest time it bothered me, that jumping from a task in the agenda to the entry in my todo.org file, always shows me the todo in context with all other task around it. I only want to see THE task and not all the other tasks further up and down the heading.

What I wanted, was simply to jump to the "narrowed" task/subtree.

It turned out that it was way more simple and straight forward than I expected. In fact it is so simple, that even I got it done without producing sweat.

(defun svbck/agenda-goto ()
  (interactive)
  (org-agenda-goto)
  (org-narrow-to-subtree))

And also adding/overriding the keybinding:

(keymap-set org-agenda-keymap "RET" 'svbck/agenda-goto)

And that's it.

And while I was already at it I added the same functionality to consult-agenda-goto:

(defun svbck/consult-agenda-goto ()
  (interactive)
  (consult-org-agenda)
  (org-narrow-to-subtree))

Naturally I added a custom keybinding to that.

Both of the above have, already after a few days, made working with the agenda much more fluently and efficient.


UPDATE: After publishing this post to Mastodon Christian and Jack had some interesting suggestions to the above setup:

https://fosstodon.org/@svbck/111945739870788047


And one more update a day later

While I still haven't yet successfully managed the same setup with the task showing not narrowed but as an indirect-buffer to avoid having to widen the buffer again, the "narrowed" setup works well for me, as what I originally wanted, is to merely show the task "under" the agenda-view.

I didn't though took into consideration, what happens if one is using a wider window-configuration as I do. I usually only use one window, which is not wide enough for horizontal splits, thus the my "task-view" always shows under the agenda - which is where I want to be in fact.

While that is still a WIP, I had the idea to create a variation of my agenda-goto function which opens the task in view mode, which is helpful when all I want have a qukck look at the task as it can be quickly dismissed with q.

  (defun svbck/agenda-goto-view ()
  "Jump to the task narrowed but in view mode only to get a glance"
  (interactive)
  (org-agenda-goto)
  (org-narrow-to-subtree)
  (view-mode t))

(keymap-set org-agenda-keymap "SPC" 'svbck/agenda-goto-view)

I have some ideas how to built this out a bit more, but that will require more digging around.

Reply via Email