aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelle Licht <jlicht@fsfe.org>2023-06-10 11:58:56 +0200
committerKyle Meyer <kyle@kyleam.com>2023-06-10 19:09:31 -0400
commit0efb95abc51f4730f70670abbce462c5ac86e019 (patch)
tree31d8f9a04c8667430550b2ff00860f71a8c404c1
parent4b9490abb372b1bd66444f780a2fe352c5a89a2f (diff)
downloadpiem-0efb95abc51f4730f70670abbce462c5ac86e019.tar.gz
piem: Add piem-inbox-by-gnu-package-match
-rw-r--r--piem.el16
1 files changed, 16 insertions, 0 deletions
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