Merge pull request #1036 from wavexx/reply-ignore-regexp

mu4e: Allow to ignore addresses when doing wide replies
This commit is contained in:
Dirk-Jan C. Binnema 2017-03-05 15:57:05 +02:00 committed by GitHub
commit 9798d1fe6a
2 changed files with 38 additions and 0 deletions

View File

@ -191,6 +191,30 @@ the list form the original."
reply-to)))
(defun mu4e~strip-ignored-addresses (addrs)
"Return all the addresses in ADDRS not matching
`mu4e-compose-reply-ignore-address'."
(cond
((null mu4e-compose-reply-ignore-address)
addrs)
((functionp mu4e-compose-reply-ignore-address)
(remove-if
(lambda (elt)
(funcall mu4e-compose-reply-ignore-address (cdr elt)))
addrs))
(t
;; regexp or list of regexps
(let* ((regexp mu4e-compose-reply-ignore-address)
(regexp (if (listp regexp)
(mapconcat (lambda (elt) (concat "\\(" elt "\\)"))
regexp "\\|")
regexp)))
(remove-if
(lambda (elt)
(string-match regexp (cdr elt)))
addrs)))))
(defun mu4e~draft-create-cc-lst (origmsg reply-all)
"Create a list of address for the Cc: in a new message, based on
the original message ORIGMSG, and whether it's a reply-all."
@ -211,6 +235,8 @@ the original message ORIGMSG, and whether it's a reply-all."
(mu4e~draft-address-cell-equal cc-cell to-cell))
(mu4e~draft-create-to-lst origmsg)))
cc-lst))
;; remove ignored addresses
(cc-lst (mu4e~strip-ignored-addresses cc-lst))
;; finally, we need to remove ourselves from the cc-list
;; unless mu4e-compose-keep-self-cc is non-nil
(cc-lst

View File

@ -387,6 +387,18 @@ are needed for sorting the contacts."
:type 'string
:group 'mu4e-compose)
(defcustom mu4e-compose-reply-ignore-address message-dont-reply-to-names
"Addresses to prune when doing wide replies.
This can be a regexp matching the address, a list of regexps
or a predicate function. A value of nil keeps all the addresses."
:type '(choice
(const nil)
function
string
(repeat string))
:group 'mu4e-compose)
(defcustom mu4e-compose-reply-to-address nil
"The Reply-To address (if this, for some reason, is not equal to
the From: address.)"