discussion and development of piem
 help / color / mirror / code / Atom feed
From: Xinglu Chen <public@yoctocell.xyz>
To: piem@inbox.kyleam.com
Subject: [PATCH] notmuch: Configure mailing list archive links
Date: Fri, 05 Feb 2021 18:10:50 +0100	[thread overview]
Message-ID: <2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz> (raw)

This adds an entry to `notmuch-show-stash-ml-archive-link-alist` that
reads the `piem-inboxes` variable and returns the public-inbox archive
url.  This means that users don't have to manually add public-inbox
archive urls to `notmuch-show-stash-ml-archive-link-alist`.
You can run `notmuch-show-stash-mlarchive-link` on this message, and
paste the link in the browser to see it in action (assuming you have
configured `piem-inboxes`).

 piem-notmuch.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/piem-notmuch.el b/piem-notmuch.el
index 5c0cd62..52d9198 100644
--- a/piem-notmuch.el
+++ b/piem-notmuch.el
@@ -106,6 +106,13 @@ (defun piem-notmuch-am-ready-mbox ()
                     (insert patch)))
+(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 (piem-inbox-by-header-match))
+        (link (piem-inbox-get :url inbox)))
+    (concat link mid)))
 (define-minor-mode piem-notmuch-mode
   "Toggle Notmuch support for piem.
@@ -119,11 +126,18 @@ (define-minor-mode piem-notmuch-mode
         (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))
+        (setq notmuch-show-stash-mlarchive-link-default "piem"))
     (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))
+    (setq notmuch-show-stash-mlarchive-link-default "Gmane")))
 ;;; piem-notmuch.el ends here
 (provide 'piem-notmuch)

             reply	other threads:[~2021-02-05 17:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 17:10 Xinglu Chen [this message]
2021-02-06  4:54 ` [PATCH] notmuch: Configure mailing list archive links Kyle Meyer
2021-02-06  8:07   ` Xinglu Chen
2021-02-06  8:44 ` [PATCH v2] " Xinglu Chen
2021-02-06 15:58   ` Kyle Meyer
2021-02-06 16:17     ` Xinglu Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz \
    --to=public@yoctocell.xyz \
    --cc=piem@inbox.kyleam.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).