This is probably simple and I've been trying to develop some lisp skills but I'm completely stumped.
What I'm trying to do is insert a link in one file every time a TODO state change occurs (probably not necessary, but you can see more details in my older Stackoverflow post). The goal is to create an index of my activities throughout the day that all link back to my agenda file. E.g.:
[2014-09-03 Wed 09:05] - STARTED this is my heading
[2014-09-03 Wed 09:34] - DONE this is my heading
[2014-09-03 Wed 09:50] - STARTED this is another task in my agenda
I tried this:
(defun andy/journal-state-change (plist-chg)
"When the state changes, link it into the journal"
(org-journal-add-entry (plist-get plist-chg :position))
)
(add-hook 'org-trigger-hook
'andy/journal-state-change)
Which, according to the org-trigger-hook documentation will be give a property list which includes a :position
property.
I modified the org-journal library to integrate this function into its journaling (snipped down for brevity):
(defun org-journal-add-entry (apoint)
"APJ 5/4/15 add call for inserting from todo state change"
(interactive)
;; code snipped here which prepares this buffer to get the new
;; journal entry
;; my additions here:
(org-insert-link (org-entry-get apoint "LOCATION") (org-entry-get apoint "DESCRIPTION") (org-entry-get apoint "DESCRIPTION") )
(set-buffer-modified-p unsaved)
)))
I'm pretty sure that's not the way to do it because I'm dealing with a point and trying to insert a link. It would be nice to just pass the TODO entry from the original but I'm not sure either how to get the link or to insert it in the other file.
Any suggestions greatly welcomed!
l
) not give you.Exporting agenda views
in the org manual if you wish to save particular outputs.