From 0efb95abc51f4730f70670abbce462c5ac86e019 Mon Sep 17 00:00:00 2001 From: Jelle Licht Date: Sat, 10 Jun 2023 11:58:56 +0200 Subject: piem: Add piem-inbox-by-gnu-package-match Message-ID: <20230610095858.26982-4-jlicht@fsfe.org> --- piem.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/piem.el b/piem.el index cf78d9b..ca10b77 100644 --- a/piem.el +++ b/piem.el @@ -492,6 +492,22 @@ 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 +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-equal (downcase p-package) + (downcase gnu-package))) + (throw 'hit (car inbox)))))))) + (defun piem-inbox-by-header-match () "Return inbox based on matching message headers. This should be called from a buffer containing a message and is -- cgit v1.2.3