mirror of https://github.com/djcb/mu.git
Merge pull request #2267 from Chris00/master
Make mu4e-message-contact-field-matches accept a list of fields
This commit is contained in:
commit
dd1b854eca
|
@ -138,17 +138,17 @@ list of those) of msg MSG matches (with their name or e-mail
|
||||||
address) regular expressions RX. If there is a match, return
|
address) regular expressions RX. If there is a match, return
|
||||||
non-nil; otherwise return nil. RX can also be a list of regular
|
non-nil; otherwise return nil. RX can also be a list of regular
|
||||||
expressions, in which case any of those are tried for a match."
|
expressions, in which case any of those are tried for a match."
|
||||||
(if (and cfield (listp cfield))
|
(cond
|
||||||
(or (mu4e-message-contact-field-matches
|
((null cfield))
|
||||||
msg (mu4e-contact-name cfield) rx)
|
((listp cfield)
|
||||||
(mu4e-message-contact-field-matches
|
(seq-find (lambda (cf) (mu4e-message-contact-field-matches msg cf rx))
|
||||||
msg (mu4e-contact-email cfield) rx))
|
cfield))
|
||||||
(when cfield
|
((listp rx)
|
||||||
(if (listp rx)
|
|
||||||
;; if rx is a list, try each one of them for a match
|
;; if rx is a list, try each one of them for a match
|
||||||
(seq-find
|
(seq-find
|
||||||
(lambda (a-rx) (mu4e-message-contact-field-matches msg cfield a-rx))
|
(lambda (a-rx) (mu4e-message-contact-field-matches msg cfield a-rx))
|
||||||
rx)
|
rx))
|
||||||
|
(t
|
||||||
;; not a list, check the rx
|
;; not a list, check the rx
|
||||||
(seq-find
|
(seq-find
|
||||||
(lambda (ct)
|
(lambda (ct)
|
||||||
|
@ -161,7 +161,7 @@ expressions, in which case any of those are tried for a match."
|
||||||
(or
|
(or
|
||||||
(and name (string-match rx name))
|
(and name (string-match rx name))
|
||||||
(and email (string-match rx email)))))
|
(and email (string-match rx email)))))
|
||||||
(mu4e-message-field msg cfield))))))
|
(mu4e-message-field msg cfield)))))
|
||||||
|
|
||||||
(defun mu4e-message-contact-field-matches-me (msg cfield)
|
(defun mu4e-message-contact-field-matches-me (msg cfield)
|
||||||
"Does contact-field CFIELD in MSG match me?
|
"Does contact-field CFIELD in MSG match me?
|
||||||
|
|
Loading…
Reference in New Issue