From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id YOe0K+ZWHmBGXwAAsNZ9tg (envelope-from ) for ; Sat, 06 Feb 2021 08:44:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id ZHF6HORWHmDXDAAAbx9fmQ (envelope-from ) for ; Sat, 06 Feb 2021 08:44:20 +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 A0F5B940276 for ; Sat, 6 Feb 2021 08:44:19 +0000 (UTC) From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1612601057; bh=yXlg2D5+pbxy6M8RKOAQrU46hDw9woBDR1VFczKH3hU=; h=From:To:Subject:In-Reply-To:References:Date; b=WgvMTed35emujeBSSpOJZzaVM9FUvM8Jx/Xo7HLxmXJLYSB2p6NrIqwfNCrFaHEGG lVkWdL2luPF/SHrUUhKNsJ61h/TCARQGVZhU8rNCqyDtNqHOlRsYS6G+Bb53wEe08M t/PZcUjU80M6aVBYrRwqLFW2R5xbCtVqMr+T/hdk= To: piem@inbox.kyleam.com Subject: [PATCH v2] notmuch: Configure mailing list archive links In-Reply-To: <2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz> References: <2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz> Message-Id: <8e8677cde716973081232aa65a37fa2fc621b15f.1612600790.git.public@yoctocell.xyz> Date: Sat, 06 Feb 2021 09:44:17 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1612601060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XxrnuXHcfZOFP8eIub/JEqkUHXrLbsZCkRHTAlaBWTA=; b=OXtTKinL5PSCLAGBvI1LYAJ2MgJMbWgEKM2Qrj23OFrCwMZurT0Rj3VbG4jycnW01EyEM/ 9vChWnlGhR7gsNEF0zgd2DQ4vxZVz8kpfsE27889+bkKbjTkKqsKZCBFEKfhUnm02l+/N4 gUHyXbCm+hkT6wOYlLEYZMBdvVE7LOYZKH6uq71L9c+LhXVNxwvYVoRnq0Fqy392l/BMIY N438RoT0a+IniikF3KspEuPEuogsXVReJ5fxYwcFvr1by2eoKhJYAuDL+K7BSxhidwrIeF Y10yQf/2zZ7g22NTFZxGriYhdIbwuu2NlcrMxGBAbC3T6F7ae9qZ+TndCTQKoQ== ARC-Seal: i=1; s=key1; d=kyleam.com; t=1612601060; a=rsa-sha256; cv=none; b=hpeCSNqDVHCwFE4KNWqbNxE6CplapBqzsJaRBovTm5Y0Jp3z1xHE6Gx5Rt8JO+moea7onm 8QIHaXqf0gm66fpZKiJB6xEECusOvGME2aNTlW+Dqm/cqJjiLveYSwX7jUWlNL06reDUHl VTuRuh+pjKrCctT9o2dLhlLTIP0R6ihVPTEELLtIRofBay10BAE7BzyCGcEXGiaMbdK/rN slf/IWJkNtwsUZ7P1RfkjgLm8issFyU06jXu0hsd28YZEkKQ+K/BlBvuB4mgor26AnhoXE v6/PHevDFaJOz3t9fqYByOQhGuUGOeO7nsCISNwTi5IytwIwJiw7Ke9aT0g7Ng== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=WgvMTed3; 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.85 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b=WgvMTed3; 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: A0F5B940276 X-Spam-Score: 0.85 X-Migadu-Scanner: scn0.migadu.com X-TUID: R9NrRcNQ7Gxi 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`. --- Changes from v1: - Use `piem-notmuch-get-inbox` instead of writing my own thing. - Give a user error if there is not url for the inbox. - Do not set `notmuch-show-stash-mlarchive-link-default`, instead add info in `piem-notmuch-mode` docstring that suggests the user to set the variable on their own. piem-notmuch.el | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/piem-notmuch.el b/piem-notmuch.el index 5c0cd62..2d6c5a3 100644 --- a/piem-notmuch.el +++ b/piem-notmuch.el @@ -106,12 +106,29 @@ (defun piem-notmuch-am-ready-mbox () (insert patch))) "mbox")))))) =20 +(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-notmuch-get-inbox)) + (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 till determine +the archive url by reading the `piem-inboxes=E2=80=99 variable. You can +also set `notmuch-show-shas-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 +136,16 @@ (define-minor-mode piem-notmuch-mode (add-hook 'piem-am-ready-mbox-functions #'piem-notmuch-am-ready-mb= ox) (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-thre= ad)) + (add-hook 'piem-mid-to-thread-functions #'piem-notmuch-mid-to-thre= ad) + (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-mbo= x) (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-threa= d))) + (remove-hook 'piem-mid-to-thread-functions #'piem-notmuch-mid-to-threa= d) + (setq notmuch-show-stash-mlarchive-link-alist + (delete '("piem" . piem-notmuch-show-get-public-inbox-link) + notmuch-show-stash-mlarchive-link-alist)))) =20 ;;; piem-notmuch.el ends here (provide 'piem-notmuch) --=20 2.29.2