123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- (require 'org)
- (org-add-link-type "notmuch" 'org-notmuch-open)
- (add-hook 'org-store-link-functions 'org-notmuch-store-link)
- (defun org-notmuch-store-link ()
- "Store a link to a notmuch search or message."
- (when (eq major-mode 'notmuch-show-mode)
- (let* ((message-id (notmuch-show-get-prop :id))
- (subject (notmuch-show-get-subject))
- (to (notmuch-show-get-to))
- (from (notmuch-show-get-from))
- desc link)
- (org-store-link-props :type "notmuch" :from from :to to
- :subject subject :message-id message-id)
- (setq desc (org-email-link-description))
- (setq link (org-make-link "notmuch:" "id:" message-id))
- (org-add-link-props :link link :description desc)
- link)))
- (defun org-notmuch-open (path)
- "Follow a notmuch message link specified by PATH."
- (org-notmuch-follow-link path))
- (defun org-notmuch-follow-link (search)
- "Follow a notmuch link to SEARCH.
- Can link to more than one message, if so all matching messages are shown."
- (require 'notmuch)
- (notmuch-show (org-link-unescape search)))
- (org-add-link-type "notmuch-search" 'org-notmuch-search-open)
- (add-hook 'org-store-link-functions 'org-notmuch-search-store-link)
- (defun org-notmuch-search-store-link ()
- "Store a link to a notmuch search or message."
- (when (eq major-mode 'notmuch-search-mode)
- (let ((link (org-make-link "notmuch-search:"
- (org-link-escape notmuch-search-query-string)))
- (desc (concat "Notmuch search: " notmuch-search-query-string)))
- (org-store-link-props :type "notmuch-search"
- :link link
- :description desc)
- link)))
- (defun org-notmuch-search-open (path)
- "Follow a notmuch message link specified by PATH."
- (message path)
- (org-notmuch-search-follow-link path))
- (defun org-notmuch-search-follow-link (search)
- "Follow a notmuch link by displaying SEARCH in notmuch-search mode."
- (require 'notmuch)
- (notmuch-search (org-link-unescape search)))
- (provide 'org-notmuch)
|