diff options
| author | Chong Yidong <cyd@stupidchicken.com> | 2011-02-12 16:45:42 -0500 |
|---|---|---|
| committer | Chong Yidong <cyd@stupidchicken.com> | 2011-02-12 16:45:42 -0500 |
| commit | 38a716559183f5eb8b20ea58275cacf90d8b7ab2 (patch) | |
| tree | 6b6172c14eb4951f94657fee276aa1218921a4e8 /lisp/mail/mail-utils.el | |
| parent | 470d996db4b850a0c4676e03de805e53703b80e0 (diff) | |
| download | emacs-38a716559183f5eb8b20ea58275cacf90d8b7ab2.tar.gz | |
Make rmail-default-dont-reply-to-names nil (Bug#7888); rename rmail-dont-reply-*.
* lisp/mail/mail-utils.el (mail-dont-reply-to-names): New variable,
from rmail-dont-reply-to-names. Callers changed.
(mail-dont-reply-to): Rename from mail-dont-reply-to.
(rmail-dont-reply-to): Make it an obsolete alias.
* lisp/mail/rmail.el (rmail-default-dont-reply-to-names): Default to
nil, and make obsolete.
(rmail-dont-reply-to-names): Alias to mail-dont-reply-to-names.
* lisp/mail/rmailsum.el (rmail-summary-sort-by-correspondent): Doc fix.
* lisp/mail/rmailsort.el (rmail-sort-by-correspondent)
(rmail-select-correspondent): Doc fix. Use mail-dont-reply-to.
* lisp/mail/rmail.el (rmail-reply): Use mail-dont-reply-to.
Diffstat (limited to 'lisp/mail/mail-utils.el')
| -rw-r--r-- | lisp/mail/mail-utils.el | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el index cb9ee7e0317..328a5d50d34 100644 --- a/lisp/mail/mail-utils.el +++ b/lisp/mail/mail-utils.el @@ -35,6 +35,17 @@ often correct parser." :type 'boolean :group 'mail) +;;;###autoload +(defcustom mail-dont-reply-to-names nil + "Regexp specifying addresses to prune from a reply message. +If this is nil, it is set the first time you compose a reply, to +a value which excludes your own email address. + +Matching addresses are excluded from the CC field in replies, and +also the To field, unless this would leave an empty To field." + :type '(choice regexp (const :tag "Your Name" nil)) + :group 'mail) + ;; Returns t if file FILE is an Rmail file. ;;;###autoload (defun mail-file-babyl-p (file) @@ -213,36 +224,31 @@ Return a modified address list." nil 'literal address 2))) address)))) -;; The following piece of ugliness is legacy code. The name was an -;; unfortunate choice --- a flagrant violation of the Emacs Lisp -;; coding conventions. `mail-dont-reply-to' would have been -;; infinitely better. Also, `rmail-dont-reply-to-names' might have -;; been better named `mail-dont-reply-to-names' and sourced from this -;; file instead of in rmail.el. Yuck. -pmr -(defun rmail-dont-reply-to (destinations) +(defun mail-dont-reply-to (destinations) "Prune addresses from DESTINATIONS, a list of recipient addresses. -All addresses matching `rmail-dont-reply-to-names' are removed from -the comma-separated list. The pruned list is returned." +Remove all addresses matching `mail-dont-reply-to-names' from the +comma-separated list, and return the pruned list." ;; FIXME this (setting a user option the first time a command is used) ;; is somewhat strange. Normally one would never set the option, ;; but instead fall back to the default so long as it was nil. ;; Or just set the default directly in the defcustom. - (if (null rmail-dont-reply-to-names) - (setq rmail-dont-reply-to-names - (concat (if rmail-default-dont-reply-to-names - (concat rmail-default-dont-reply-to-names "\\|") - "") - (if (and user-mail-address - (not (equal user-mail-address user-login-name))) - ;; Anchor the login name and email address so - ;; that we don't match substrings: if the - ;; login name is "foo", we shouldn't match - ;; "barfoo@baz.com". - (concat "\\`" - (regexp-quote user-mail-address) - "\\'\\|") - "") - (concat "\\`" (regexp-quote user-login-name) "@")))) + (if (null mail-dont-reply-to-names) + (setq mail-dont-reply-to-names + (concat + ;; `rmail-default-dont-reply-to-names' is obsolete. + (if rmail-default-dont-reply-to-names + (concat rmail-default-dont-reply-to-names "\\|") + "") + (if (and user-mail-address + (not (equal user-mail-address user-login-name))) + ;; Anchor the login name and email address so that we + ;; don't match substrings: if the login name is + ;; "foo", we shouldn't match "barfoo@baz.com". + (concat "\\`" + (regexp-quote user-mail-address) + "\\'\\|") + "") + (concat "\\`" (regexp-quote user-login-name) "@")))) ;; Split up DESTINATIONS and match each element separately. (let ((start-pos 0) (cur-pos 0) (case-fold-search t)) @@ -262,7 +268,7 @@ the comma-separated list. The pruned list is returned." (setq cur-pos start-pos))) (let* ((address (substring destinations start-pos cur-pos)) (naked-address (mail-strip-quoted-names address))) - (if (string-match rmail-dont-reply-to-names naked-address) + (if (string-match mail-dont-reply-to-names naked-address) (setq destinations (concat (substring destinations 0 start-pos) (and cur-pos (substring destinations (1+ cur-pos)))) @@ -278,6 +284,9 @@ the comma-separated list. The pruned list is returned." (substring destinations (match-end 0)) destinations)) +;; Legacy name +(define-obsolete-function-alias 'rmail-dont-reply-to 'mail-dont-reply-to "24.1") + ;;;###autoload (defun mail-fetch-field (field-name &optional last all list) |
