Allow to ignore addresses when doing wide replies

Introduce a new variable, mu4e-compose-reply-ignore-address, which matches
addresses to be skipped when doing wide replies.

This is identical in behavior to messages-dont-reply-to-names from message.el
(which we default on).
This commit is contained in:
Yuri D'Elia 2017-02-20 00:37:44 +01:00
parent ea40939810
commit 0a5224c4c8
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.)"