6

I like keeping TODOs inside my source code next to lines that need updating. Can I include these in Org-mode's agenda?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Natan Yellin
  • 6,063
  • 5
  • 38
  • 57
  • 1
    Would using Org-Babel be an option for dealing with your source code? It would allow you to flag sections as TODO when needed. (And thus allow Agenda integration directly) – Jonathan Leech-Pepin Sep 26 '11 at 17:38
  • Thanks for the suggestion, but that's not possible. I want to collect TODOs from a company project with a large codebase. – Natan Yellin Sep 26 '11 at 19:15

2 Answers2

5

You would need to add those files to your org-agenda-files. But this is going to clutter your agenda with all the stuff inside your source files and there is nothing like an org-prog-mode I know of.

It might be easier to invert the process by defining an appropriate org-capture. You can just use the place from which you triggered the capture process and put it as a link in the entry you create. You can then navigate to the place by using C-o when the point is on top of the right entry. You probably also want to use org-refile to get the TODO to the proper subtree for your project.

Actually the default capture template is pretty close to what works for me:

("t" "Task" entry (file+headline "/path/to/org/notes.org" "Tasks") "* TODO %?
  %u
  %a" :prepend t)
adl
  • 15,627
  • 6
  • 51
  • 65
pmr
  • 58,701
  • 10
  • 113
  • 156
  • Unfortunately the code line number will be wrong if I update my code. – Natan Yellin Sep 26 '11 at 14:30
  • 1
    @NatanYellin Yes, which is unfortunate. You probably can hack around this with storing part of the buffer in the link and search for that part on opening the link and adding something like this as your own link type. I don't have any experience with customizing links but that looks like the right path to me. – pmr Sep 26 '11 at 14:37
  • This is exactly how I do it too. If the TODO stays undone long enough for the code to massively change, you've got more serious issues than just tracking. :) – Noufal Ibrahim Oct 04 '11 at 13:35
  • @Noufal I tried writing something like org-prog-mode to use source code files inside the agenda but its just impossible without slowing down the building of the agenda excessively when the source file is huge. Sad story. – pmr Oct 04 '11 at 15:18
2

A possible solution to this showed up on the mailing list, it was designed to keep track of links to content within C/C++ source code.

http://thread.gmane.org/gmane.emacs.orgmode/47816/focus=48556

If you're using something other than C/C++ it would likely need to be adjusted to be able to properly trace back the links.

It would not directly allow you to insert your TODOs in the source code and have them show up in the agenda, however you could create TODO headlines in an org file, and use the links to match them to the relevant points of your source code.

Jonathan Leech-Pepin
  • 7,684
  • 2
  • 29
  • 45