I'm working on a C++ project. Suppose I have the following directory structure:
project/
project/src
And I have the following files:
project/ChangeLog
project/todo.org
project/src/foo.cpp
I can work on the C++ source code in foo.cpp
and then add a line into the ChangeLog file just with C-x 4 a
as this page describes.
How can I achieve that same kind of functionality with org-mode on the file todo.org
. I would like to keep a to do list relative to the source code. So if in foo.cpp
I need to finish a function void Foo::bla()
I would like an entry to be added to todo.org
that mentions this function and the file it resides in much like C-x 4 a
does for ChangeLog.
I would also like to be able to have the backward link from the org file to the foo.cpp
file in which the to-do task is.
While org-mode is documented extensively, I do find the online manual to be very dense. Luckily, there are many good tutorials online, but it's sometimes hard to find the answer to a specific problem.
I suggest reading the org-mode manual section on Capture. You'll need to do a little setup and the specifics depend on what version of org-mode you have. (I recommend using 7.x. If you're stuck on 6.x, none of the capture setup I describe below will work.)
Here's a simple snippet from my emacs setup:
;;; capture mode
(setq org-default-notes-file (concat org-directory "/capture.org"))
(define-key global-map "\C-cc" 'org-capture)
(setq org-capture-templates
'(("t" "Todo" entry (file+headline org-default-notes-file "Tasks")
"** TODO %?\n %i\n %a")
("j" "Journal" entry (file+headline "~/journal/journal.org" "Today")
"** %?\nEntered on %U\n %i\n %a")))
Now I hit C-c c when I'm in my source file. Org-mode lets me select a template ([t]odo or [j]ournal in the example above), and fills it in including a link to the line I was on when I initiated the capture.
Updated with info about Refiling: If you have multiple projects and want to keep separate todo lists, you should also learn about Refiling. The simplest setup is to have org-refile-targets
contain a list of your todo.org files. During the capture process, you can "refile" the task directly into any of your refile targets.
(setq org-refile-targets
'((nil :maxlevel . 2)
("~/project/todo.org" :level . 1)))
There's a nice walkthrough of capture and refiling on this page about org-mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With