From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:863f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id SDBBMvogHmC4YgAAsNZ9tg (envelope-from ) for ; Sat, 06 Feb 2021 04:54:18 +0000 Received: from out1.migadu.com ([2001:41d0:2:863f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gFliI/ggHmAsNAAAB5/wlQ (envelope-from ) for ; Sat, 06 Feb 2021 04:54:16 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1612587256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NHFKOEtebJID9Dh4KNS6dJAr+BN47pFwHYiRP7fL8I8=; b=YJqs4vpQaSMV0d389E2SF42cqMTmV37GGNxEoLmt15JR9v7vJYu3Kpamu6wXE0zTGTcNT6 koQ4xrS9n2WfnTFWJByzLOTdwV/Qwa5q0b67NkNnaz70GLmMlQIqjl1ootcwiExKCn/Viq Xzgr3cFZKKlRvuy3fhviPmWCTV7Cqa/rIKWMYPXuYDyV8r/PxbegUrwURfe7AmSsVel2ak LnZWmoK83wgAVOYGCh4GK5albb0NcAPDHz3RlHKW0S5aZO26L6aw//BWvfmjUaCOCzCgHK drW0J7EVyXPhuQO7Y1TTN4ACRauVqpWBZ0XUzMvRuTfnqkX7nNvI3O3JJ+TPjQ== From: Kyle Meyer To: Xinglu Chen Cc: piem@inbox.kyleam.com Subject: Re: [PATCH] notmuch: Configure mailing list archive links In-Reply-To: <2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz> References: <2ffe23775ec008feb763e24c29786fc5feddb975.1612544763.git.public@yoctocell.xyz> Date: Fri, 05 Feb 2021 23:54:09 -0500 Message-ID: <878s81kd8u.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: D4ecVLEZTeMO Xinglu Chen writes: > 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`. Nice idea. I regularly use notmuch-show-stash-mlarchive-link with public-inbox targets and will happily drop my manual entries :) I've considered something related in the past: adding a command in the piem-dispatch transient that essentially does (when-let ((inbox (piem-inbox))) (kill-new (message "%s" (concat (piem--ensure-trailing-slash (piem-inbox-get :url inbox)) (piem-escape-mid (or (piem-mid) (user-error "No message ID found for the current buffer"))))))) In notmuch, I'm already too accustomed to using notmuch-show-stash-mlarchive-link (and more generally notmuch-show-stash-map), but I think I'd occasionally find the above useful in Gnus. Hmm, perhaps I'll add such a command this weekend, along with a section in the manual where we can mention it as well as the notmuch-show-stash-mlarchive-link support added by this patch. > 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))) This will usually work, but * mid should be escaped with piem-escape-mid. * piem-inbox-by-header-match should be executed within piem-notmuch--with-current-message so that it can match against the full set of headers (which is important for matching the list ID). Better yet, just use piem-notmuch-get-inbox, which already does that. * What about in cases where there is no inbox/url? Right now it would just return the plain message ID. Should it signal a user-error instead? > + > ;;;###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")) I'd rather not override the user's notmuch-show-stash-mlarchive-link-default setting (even if we were to only do so for the default value of "Gmane", which we know is nonfunctional and not likely coming back at this point). Instead, how about just mentioning notmuch-show-stash-mlarchive-link support in piem-notmuch-mode's docstring along with a suggestion to set notmuch-show-stash-mlarchive-link-default to "piem"?