From b4470a4921740a13114d6d4b7fbd1b04c5ecaeee Mon Sep 17 00:00:00 2001 From: Jelle Licht Date: Sat, 10 Jun 2023 11:58:57 +0200 Subject: piem-inbox-by-header-match: Fallback to matching via :gnu-package Message-ID: <20230610095858.26982-5-jlicht@fsfe.org> --- piem.el | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/piem.el b/piem.el index ca10b77..d202e15 100644 --- a/piem.el +++ b/piem.el @@ -513,22 +513,25 @@ used by libraries implementing a function for This should be called from a buffer containing a message and is intended to be used by libraries implementing a function for `piem-get-inbox-functions'." - (pcase-let ((`(,listid ,to ,cc) - (piem--message-fetch-decoded-fields '("list-id" "to" "cc")))) - (catch 'hit - (dolist (inbox (piem-merged-inboxes)) - (let* ((info (cdr inbox)) - (p-listid (plist-get info :listid))) - (when (and listid - p-listid - (string-match-p (concat "<" (regexp-quote p-listid) ">") - listid)) - (throw 'hit (car inbox))) - (when-let ((addr (plist-get info :address)) - (to (mapconcat #'identity (list to cc) - " "))) - (when (string-match-p (regexp-quote addr) to) - (throw 'hit (car inbox))))))))) + (pcase-let ((`(,listid ,to ,cc ,gnu-package) + (piem--message-fetch-decoded-fields + '("list-id" "to" "cc" "x-gnu-pr-package")))) + (or (catch 'hit + (dolist (inbox (piem-merged-inboxes)) + (let* ((info (cdr inbox)) + (p-listid (plist-get info :listid))) + (when (and listid + p-listid + (string-match-p + (concat "<" (regexp-quote p-listid) ">") + listid)) + (throw 'hit (car inbox))) + (when-let ((addr (plist-get info :address)) + (to (mapconcat #'identity (list to cc) + " "))) + (when (string-match-p (regexp-quote addr) to) + (throw 'hit (car inbox))))))) + (piem-inbox-by-gnu-package-match gnu-package)))) (defun piem-inbox () "Return the current buffer's inbox." -- cgit v1.2.3