From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id AD1QLCN8HWDGFgAAsNZ9tg (envelope-from ) for ; Fri, 05 Feb 2021 17:10:59 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id GN81HiF8HWByOQAA1q6Kng (envelope-from ) for ; Fri, 05 Feb 2021 17:10:57 +0000 Received: from mail.yoctocell.xyz (h87-96-130-155.cust.a3fiber.se [87.96.130.155]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B12AD9402C8 for ; Fri, 5 Feb 2021 17:10:53 +0000 (UTC) From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1612545051; bh=gYcO8L8numUHwZTYaXl7xv5idHvLu2pCyr6MnzMJzGw=; h=From:To:Subject:Date; b=RKUPzztpiv/S+wWljVBwvmQTrFDtb/3BWX639NIi8Gsus1Qe+geUBgXkNhAgKQyWz f8Rs4KP8IyYSAM8Bk8apGjWLDqY1zSgIQQ5clf5d3VlJr3IQxVjnEO8E2TPBL+RSRM QD7WUO436C5nj+DVHcbtSabh5b9L4CxHRLyhJ/9k= To: piem@inbox.kyleam.com Subject: [PATCH] notmuch: Configure mailing list archive links Message-Id: <2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz> Date: Fri, 05 Feb 2021 18:10:50 +0100 MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1612545057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=AvUow58pJzeiS7qjvb8wh4fvPft4LVRCNEHIY0MSIfI=; b=iiGol0I+P9o0Eu9DZg6ChaXRtn/bhUTgzn/VPWDn15JE+/awu9zJCHqoIGmhUgh1Burkf8 Z4/l9izZe168/JA7aVQQ4PuL9+YgnBtmTRgrtClwZQzFKH4+6eB0qe2MZVTSbgaMnBDvu5 yT0R1zOUGeh4IDnCvfZugzHB4Qlo3lG3bFV+MLTCcadLr2Z4HVF7v4kAgBFdBuJU5qcMsK eneEOVS0c8fRVitLUOKhK7KvMdCMdBWSlP+zABt5ITOA4uaqMgMCGRq5v2Q7liGMDbob8h xX3g6KYpFtU/mBYbrHTw8LaJLak+7fGSYQUpnghKXHTsUqrmLBnPB9MQlW1gBA== ARC-Seal: i=1; s=key1; d=kyleam.com; t=1612545057; a=rsa-sha256; cv=none; b=QefpV7rnAL0O9kuAF6wxIO/tcQWMnuG7kCtmnidbEuBK6AB7XA2E+Jq589jYEAS5MBGyob fybbcxqoCfctPcKxhcDrihVdkdBEfW4HoioARQ+PetAXemnGFtEhTfTJ0BdqNklnEUSmjl 1Ih32aBdvpKjjsrJU1oCWT3IoXpLSf0XmVYT3jgxPKyzdRssz6dJI06m/S04YX4YRtegyB 1f/hbha0/DucLVyheEbWoRxVhtZAzGfkusF1Uz0+93k6fwWT1JgmAXDxXthK8hh81NOUf+ 5qV0zhgNK8f0+hn9Ubf5n+bKdsu2fRyvNu1CmcHlJ5kIT3mGidmnq2cinHrHBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=RKUPzztp; dmarc=pass (policy=none) header.from=yoctocell.xyz; spf=pass (aspmx1.migadu.com: domain of public@yoctocell.xyz designates 87.96.130.155 as permitted sender) smtp.mailfrom=public@yoctocell.xyz X-Migadu-Spam-Score: 0.89 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=RKUPzztp; dmarc=pass (policy=none) header.from=yoctocell.xyz; spf=pass (aspmx1.migadu.com: domain of public@yoctocell.xyz designates 87.96.130.155 as permitted sender) smtp.mailfrom=public@yoctocell.xyz X-Migadu-Queue-Id: B12AD9402C8 X-Spam-Score: 0.89 X-Migadu-Scanner: scn0.migadu.com X-TUID: MM/BbzqDuOhw 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))) "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 (piem-inbox-by-header-match)) + (link (piem-inbox-get :url inbox))) + (concat link mid))) + ;;;###autoload (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) -- 2.29.2