Org capture is a great tool for capturing notes and task when doing other things inside Emacs. The captured item is stored in a specified file for later review, and the point jumps back to the file it was in when you got the idea. Practical. However, I am also using capture to make tasks when working deliberately in my task file. In this case it would be much more handy if the task template saved the new task at point whichever file I am in, and not to a predefined capture file. After the task is produced I would like point to stay in the headerline of this new task. Is this possible?
Here is a capture template I use for producing task items:
(setq org-capture-templates '((
"t" ; key
"Todo" ; description
entry ; type
(file+headline "C:/.../privat.org" "tasks") ; target
"* TODO [#B] %^{Todo} \nSCHEDULED: %t \n\n%?" ; template
:prepend t ; properties
)))
It stores the produced task to the file "C:/.../privat.org"
under the heading "tasks"
, and the "prepend"
property makes the new task to be placed as the first subheading under "task".
How can I make the new task be stored at point in whatever file I work in?
(file+function "path/to/file" function-finding-location)
[A function to find the right location in the file.] The custom function doesn't need to really do anything -- e.g.,(lambda () (message "hello-world"))
-- since the original poster is already at the desired location -- i.e., nothing to do.(function function-finding-location)
[Most general way, write your own function to find both file and location.] -- and something like:(function (lambda () (message "You have already arrived at your destination.")))