I use Outlook as my email client at work, but I don't want to use it to manage my tasks and todos. (Instead I use plain text files and Emacs org-mode.) Since many todo items start out as mails in my inbox, I often need to reference these mails.
Is there some clever way to create a link (a URL) that opens a specific email in Outlook when clicked?
You can do this with a little bit of code in Outlook and a little bit of code in Emacs.
First, if you're using Outlook 2007 you'll need to enable Outlook URLs with a registry addition. Instructions and the registry file can be found here courtesy of David Tan.
Next, this macro can be added to Outlook and will get the GUID of the current email message, create a Org-Mode link and deposit it into the clipboard.
'Adds a link to the currently selected message to the clipboard
Dim objMail As Outlook.MailItem
Dim doClipboard As New DataObject
'One and ONLY one message muse be selected
If Application.ActiveExplorer.Selection.Count <> 1 Then
MsgBox ("Select one and ONLY one message.")
Set objMail = Application.ActiveExplorer.Selection.Item(1)
doClipboard.SetText "[[outlook:" + objMail.EntryID + "][MESSAGE: " + objMail.Subject + " (" + objMail.SenderName + ")]]"
Almost there, add this little bit of lisp to your emacs lisp directory to enable Outlook links.
;;; org-outlook.el - Support for links to Outlook items in Org
(org-add-link-type "outlook" 'org-outlook-open)
(defun org-outlook-open (id)
"Open the Outlook item identified by ID. ID should be an Outlook GUID."
(w32-shell-execute "open" (concat "outlook:" id)))
;;; org-outlook.el ends here
And lastly, update your .emacs file to include the Outlook link code. Just add this somewhere after org-mode is setup.
Now you can call the macro (I added it to my toolbar in Outlook for quick access) and you can quickly create a link to the email in Emacs.
One gotcha, GUID's change when you move a message between document stores, so if you get the GUID to the message while it's on your Exchange server and then move it to your local PST file the link will change. Move the message before you get the GUID.
I'm not sure about referencing a specific email but depending on your system you might be able to copy the email to the same location as the todo item. Just drag/drop the mail to a folder or the desktop and it will create a copy of the mail that you can treat as a normal file.
If you would be using .doc or more "advanced" files than .txt you could then link to this Outlook message file.
I prefer to copy the Outlook Item content to the system clipboard and then yank it into an Org-mode note.
Emacs has something called message-mode (type M-x message-mail) that can be used to compose emails. This mode helps one to automatically wrap text to 72 columns .. keeping quoted marks properly.
Is there such a thing for VIM?
I am switching from Emacs to VIM and message-mode is the only thing that needs to be migrated.
NOTE: I don't want VIM to send emails; for that .. I use some other client. I only want to edit emails in VIM.
Yes. Vim implements message-mode using filetypes.
Vim should be able to autodetect that you're editing a mail message. It should automatically set the filetype to mail. You can check this by displaying the current value of filetype by typing (in command mode) ...
You can also force Vim to use a particular filetype. In command mode, type ...
to force Vim to set the default editing preferences for mail messages.
You can read more about filetypes in the Vim help system.
I like to run vim (vim7) as:
vim -c "set spell spelllang=en" -c "set tw=72" -c "set filetype=mail"
this turns on the built-in spell checker, line wrapping on word boundaries at 72 characters and file syntax highlighting as email.
You want this command:
Assuming that your window is set for 80 characters wide. This sets the wrap margin 8 characters from the right hand side, which gives you a width of 72.
You can abbreviate wrapmargin to wm
You may also want to check the email category at this wiki about VIM