Skip to content

Instantly share code, notes, and snippets.

@ephsmith
Last active September 6, 2023 09:57
Show Gist options
  • Save ephsmith/ffbf1e75365b8d4db973bb6957548b6c to your computer and use it in GitHub Desktop.
Save ephsmith/ffbf1e75365b8d4db973bb6957548b6c to your computer and use it in GitHub Desktop.
org-airmail.el adds an org-hyperlink handler for Airmail email URLs
;;; org-airmail.el - Support for links to Airmail 3 messages in Org
(require 'org)
(org-add-link-type "airmail" 'org-airmail-open)
(defun org-airmail-open (url)
"Visit the Airmail message referenced by URL.
URL should be a vaid Airmail message url retrieved from Airmail with
'Copy Message Link'."
(shell-command
;; Note: org strips "airmail:" from the link URL
(concat "open -a '/Applications/Airmail 3.app' airmail:"
(shell-quote-argument url))))
(provide 'org-airmail)
;;; org-airmail.el ends here

Description

If you’re an Airmail 3 user, this provides the ability to link to an Airmail email within an org document. This Gist uses the orgmode mechanism for adding additional hyperlink types.

Installation

Save the file to your Emacs load-path and add (require 'org-airmail) to your Emacs init file.

Usage

  1. Copy and Airmail message link in Airmail (Edit-> Copy Message Link).
  2. Insert the link into an orgmode file just as you would any other (C-c C-l ...)
@roryk
Copy link

roryk commented Aug 19, 2020

Thank you for this!

@glauschwuffel
Copy link

Thanks for this!

I just found this today. My emacs tells me that org-add-link-type is deprecated since Org 9.0, so I changed its use to this:

(org-link-set-parameters "airmail" :follow 'org-airmail-open)

Other than that it works out of the box 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment