Rudolf Adamkovič Personal site


Configuration: Org integration

Enable ‘org-store-link’ for Org.

(with-eval-after-load 'org

  (defun my-org-notmuch-store-link ()
    "Store a link to a Notmuch mail message."
    (interactive)
    (pcase-let ((`(,id . ,description)
                 (pcase major-mode
                   ('notmuch-show-mode
                    (cons (notmuch-show-get-message-id)
                          (notmuch-show-get-subject)))
                   ('notmuch-search-mode
                    (cons (notmuch-search-find-thread-id)
                          (notmuch-search-find-subject))))))
      (when id
        (org-store-link-props :type "notmuch"
                              :link (concat "notmuch:" id)
                              :description description))))

  (defun my-org-notmuch-follow-link (path)
    ;; Not called directly because that does not trigger the auto load.
    (require 'notmuch-show)
    (notmuch-show path))

  (org-link-set-parameters "notmuch"
                           :store #'my-org-notmuch-store-link
                           :follow #'my-org-notmuch-follow-link))

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.