Reputation: 53
I use org-mode + gnus + Gmail for my daily GTD routine. The concept is that treating all incoming messages as tasks, and converting all messages in INBOX into org-mode's tasks using org-capture. Once all new messages are converted into tasks, archive them, and hopefully INBOX is kept zero.
My workflow is as follows:
The problem is that when moving a message into the archive folder, the captured link becomes broken, and I cannot follow the link anymore. This is because the captured link includes the IMAP folders' name and archiving message changes the message's IMAP folder name. E.g.,
[[gnus:nnimap%2Blocalhost:%5BGmail%5D.Important#1364607772002.9702fb8c@Nodemailer][Email from Geeklist Team: Geekli.st Suggestions & Activi]]
(IMAP folder name is "[Gmail]Important"
)[[gnus:nnimap%2Blocalhost:%5BGmail%5D.All Mail#1364607772002.9702fb8c@Nodemailer][Email from Geeklist Team: Geekli.st Suggestions & Activi]]
(IMAP folder name is "[Gmail]All Mail"
)So my question is: how can I update the captured link automatically when the message is moved to other folders? I guess there are some hooks to do this, but I could not find a good sample for this purpose. Or any simpler solutions for this kind of routine are welcome. TIA.
Upvotes: 5
Views: 3329
Reputation: 106
I do not use 'org-store-link' and 'org-insert-link' but a capture template, that automatically generates a link to the message (%a below). So you do not have to switch buffers to store a TODO entry:
(setq org-capture-templates '( ("m" "TODO from Mail" entry (file+headline "~/gitfiles/org/gtd.org" "Inbox") "* TODO %?, Link: %a")))
Since all my emails arrive in the INBOX and are archived in the folder "Archive" I can just use the following function which replaces the string 'INBOX' by 'Archive' in the Org mode link in the capture buffer:
(defun hs/replace () (interactive) (goto-char 1) (replace-string "INBOX" "Archive"))
This hook calls the function when I hit C-c C-c to file the capture entry:
(add-hook 'org-capture-prepare-finalize-hook 'hs/replace)
So, my workflow is as follows:
HTH
Upvotes: 9