[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Need help writing predicate function
From: |
Max Evans |
Subject: |
Need help writing predicate function |
Date: |
Mon, 04 Dec 2023 16:44:35 +0000 |
Help, gnus!
I'm trying to write a simple predicate function to use in my
posting-styles, since from my reading of the manual you can't match
two things at once otherwise, which is what I want to do.
I'm trying to make a rule that kicks in only when a certain company
sends me an email AND when it's sent to a particular address. It's
only relevant when I'm replying back to them, though.
Here's what I've got so far:
(defun max-gnus-predicate ()
(when (eq major-mode 'gnus-article-mode)
(and (string-match "foo@bar.org" (with-current-buffer gnus-article-buffer
(message-fetch-field "from")))
(string-match "visitantar+alias@protonmail.com" (with-current-buffer
gnus-article-buffer
(message-fetch-field
"to"))))))
The problem I'm running into is that the function fails if the
*Article* buffer ever gets killed. When that happens, it corrupts the
mail header. Which makes sense with how I've written it.
I'm sure there's a smarter way of doing what I want to do, so would
someone mind helping me out?
(Please keep me in the thread. I'm not subscribed.)
-Max
- Need help writing predicate function,
Max Evans <=