diff options
author | Jelle Licht <jlicht@fsfe.org> | 2023-06-10 11:58:57 +0200 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2023-06-10 19:09:31 -0400 |
commit | b4470a4921740a13114d6d4b7fbd1b04c5ecaeee (patch) | |
tree | f2b1adb000d95460792c09164ebd177dbd9dcdc8 | |
parent | 0efb95abc51f4730f70670abbce462c5ac86e019 (diff) | |
download | piem-b4470a4921740a13114d6d4b7fbd1b04c5ecaeee.tar.gz |
piem-inbox-by-header-match: Fallback to matching via :gnu-package
Message-ID: <20230610095858.26982-5-jlicht@fsfe.org>
-rw-r--r-- | piem.el | 35 |
1 files changed, 19 insertions, 16 deletions
@@ -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." |