My e-mail client is mu4e. I can easily create links to org-mode files via org-mu4e-store-and-capture, as described here https://www.djcbsoftware.nl/code/mu/mu4e/Org_002dmode-links.html, for instance.

Now I would like to additionally link from some non-emacs MacOS app, such as the calendar, to e-mails in mu4e. I have to solve two problems for this:

(1) When I have already a link to an e-mail message of the form mu4e:msgid:[email protected] (like the links stored in org mode). How can I open such a link via emacsclient?

I would like to run the command

/usr/local/bin/emacsclient --eval 'SOMEFUNCTION "mu4e:msgid:[email protected]"'

in a shell, where SOMEFUNCTION is the function that org-mode calls when a link of the form mu4e:msgid:[email protected] is clicked. How can I determine the name of this function, in order to use it in the above shell command?

(2) When I am viewing an e-mail in mu4e, I would like to call a function that provides me with the mu4e:msgid:[email protected] link to this e-mail. This happens (among other things) in org-mu4e-store-and-capture, how can I use this to copy a link to the clipboard in order to paste it to another MacOS application?

Thanks in advance for any advice!

1 Answer 1

  1. To open a link from a string:
(org-link-open-from-string "mu4e:msgid:[email protected]")
  1. To make the stored link the latest kill in the kill ring:
(advice-add 'org-store-link :after
        (lambda (arg &optional interactive?)
          (when (or (eq major-mode 'mu4e-headers-mode)
                    (eq major-mode 'mu4e-view-mode))
            (kill-new (caar org-stored-links)))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.