From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:1004:224b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12.migadu.com with LMTPS id qCD1FMkChGTQAwEATFOONw (envelope-from ) for ; Sat, 10 Jun 2023 06:57:45 +0200 Received: from mta0.migadu.com ([2001:41d0:1004:224b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iJLVFMkChGSfPwAA9RJhRA (envelope-from ) for ; Sat, 10 Jun 2023 06:57:45 +0200 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=1686373065; 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; bh=PWghltbCNIUzmyrAKNeKJDU9vBEjEJs38bWB6mb+HNU=; b=SGgnEisJnEg4xot86SCBGHkXMYn3i3FFdq4SOThLnt3OPjQ3U3xG23vWXaij63csT+hI55 qlV34GrNUs5/hRgP7S2laMhVdNJfcaChlfZShfoywAoxiErgYik6cty94n1KUr59SmEtcZ bLJUq0R895N8d4LtdQiIso1cl5m9GsExDz9twvNavcDG+ojRiPSGX9EDIGs+0f7gclp0A1 xeFX4kZEeLQ12YPzNj66wi+HoemRMADBvJkPXqhLb1oiIF2okX4te1/SpbzV6bLBHRGe14 WWE2wQGbDWCuFE9U7jzGgzEAUUl/7NnUYajiiqHSbXFxaMSSj283bFt5HZ62mg== From: Kyle Meyer To: jlicht@fsfe.org Cc: piem@inbox.kyleam.com Subject: Re: [PATCH v2 3/5] piem: Add piem-inbox-by-gnu-package-match. In-Reply-To: <20230609124829.29629-4-jlicht@fsfe.org> Date: Sat, 10 Jun 2023 00:57:43 -0400 Message-ID: <87sfazncc8.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-TUID: DNJFsEsyE7BL jlicht@fsfe.org writes: > diff --git a/piem.el b/piem.el > index 914dd23..3fffb0e 100644 > --- a/piem.el > +++ b/piem.el > @@ -490,6 +490,21 @@ non-nil, make the match specific for that message." > (mail-decode-encoded-word-string val))) > headers)))) > > +(defun piem-inbox-by-gnu-package-match (gnu-package) > + "Return inbox based on matching :gnu-package properties. > +GNU-PACKAGE should be a string. This function is intended to be Convention: two spaces after period > +used by libraries implementing a function for > +`piem-get-inbox-function'." > + (when gnu-package > + (catch 'hit > + (dolist (inbox (piem-merged-inboxes)) > + (let* ((info (cdr inbox)) > + (p-package (plist-get info :gnu-package))) > + (when (and gnu-package > + p-package > + (string-match-p p-package gnu-package)) > + (throw 'hit (car inbox)))))))) > + I think it's nice to have this as a separate function, and I'm guessing its use in the upcoming piem-debbugs.el is one of the reasons you decided to do that. But perhaps piem-inbox-by-gnu-package-match should still be called in piem-inbox-by-header-match, following the dolist there. The main advantage of that is that debbugs.el also has Rmail support, so it'd let piem-rmail-get-inbox take advantage of this header too. Plus, if piem-notmuch users want to match against X-GNU-PR-PACKAGE for whatever reason, even though they should have a List-ID too, it seems like we might as well consistently support it.