diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-02-06 10:54:21 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-02-06 10:54:32 -0500 |
commit | 55e90c824e41b36b7766dd13fa0117c2025f71af (patch) | |
tree | eeacf4947ec6cc1cfea3838a3ec31bc4c11340f2 | |
parent | d0fbd5c70d7ddcd2c8f275f91eb2f5743ea82f21 (diff) | |
parent | fad8d59d5a7437411e96dc9e8addfb3e02e459d7 (diff) | |
download | piem-55e90c824e41b36b7766dd13fa0117c2025f71af.tar.gz |
Merge branch 'xc/notmuch-configure-mailing'
-rw-r--r-- | piem-notmuch.el | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/piem-notmuch.el b/piem-notmuch.el index cf2a83b..a222f3f 100644 --- a/piem-notmuch.el +++ b/piem-notmuch.el @@ -106,12 +106,31 @@ message itself if it looks like a patch." (insert patch))) "mbox")))))) +(defun piem-notmuch-show-get-public-inbox-link (mid) + "Given the message-id MID, return the public-inbox url. +This will lookup the url in the `piem-inboxes' variable." + (let* ((inbox (or (piem-notmuch-get-inbox) + (user-error "No inbox associated with current buffer"))) + (link (or (piem-inbox-get :url inbox) + (user-error "No url was found for %s" inbox)))) + (concat + (piem--ensure-trailing-slash link) + (piem-escape-mid mid)))) + ;;;###autoload (define-minor-mode piem-notmuch-mode "Toggle Notmuch support for piem. + With a prefix argument ARG, enable piem-notmuch mode if ARG is positive, and disable it otherwise. If called from Lisp, enable -the mode if ARG is omitted or nil." +the mode if ARG is omitted or nil. + +This will add a new entry to +`notmuch-show-stash-mlarchive-link-alist' which will determine +the archive url by reading the `piem-inboxes' variable. You can +also set `notmuch-show-stash-mlarchive-link-default' to \"piem\" +to make this the default behavior when calling +`notmuch-show-stash-mlarchive-link'." :global t :init-value nil (if piem-notmuch-mode @@ -119,11 +138,16 @@ the mode if ARG is omitted or nil." (add-hook 'piem-am-ready-mbox-functions #'piem-notmuch-am-ready-mbox) (add-hook 'piem-get-inbox-functions #'piem-notmuch-get-inbox) (add-hook 'piem-get-mid-functions #'piem-notmuch-get-mid) - (add-hook 'piem-mid-to-thread-functions #'piem-notmuch-mid-to-thread)) + (add-hook 'piem-mid-to-thread-functions #'piem-notmuch-mid-to-thread) + (add-to-list 'notmuch-show-stash-mlarchive-link-alist + '("piem" . piem-notmuch-show-get-public-inbox-link))) (remove-hook 'piem-am-ready-mbox-functions #'piem-notmuch-am-ready-mbox) (remove-hook 'piem-get-inbox-functions #'piem-notmuch-get-inbox) (remove-hook 'piem-get-mid-functions #'piem-notmuch-get-mid) - (remove-hook 'piem-mid-to-thread-functions #'piem-notmuch-mid-to-thread))) + (remove-hook 'piem-mid-to-thread-functions #'piem-notmuch-mid-to-thread) + (setq notmuch-show-stash-mlarchive-link-alist + (delete '("piem" . piem-notmuch-show-get-public-inbox-link) + notmuch-show-stash-mlarchive-link-alist)))) ;;; piem-notmuch.el ends here (provide 'piem-notmuch) |