changeset 1431:240d5fe38595

(mail-setup): Call build-mail-aliases, not mail-abbrev-setup. (sendmail-send-it): Call expand-mail-aliases.
author Richard M. Stallman <rms@gnu.org>
date Sun, 18 Oct 1992 22:19:36 +0000
parents f680a6fb6661
children 7446ab662993
files lisp/mail/sendmail.el
diffstat 1 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/sendmail.el	Sun Oct 18 19:10:56 1992 +0000
+++ b/lisp/mail/sendmail.el	Sun Oct 18 22:19:36 1992 +0000
@@ -62,6 +62,10 @@
 feature from that of defining aliases in `.mailrc' to be expanded in Emacs.
 This variable has no effect unless your system uses sendmail as its mailer.")
 
+(defvar mail-aliases t
+  "Alias of mail address aliases,
+or t meaning should be initialized from `~/.mailrc'.")
+
 (defvar mail-yank-prefix nil
   "*Prefix insert on lines of yanked message being replied to.
 nil means use indentation.")
@@ -69,6 +73,17 @@
 (defvar mail-abbrevs-loaded nil)
 (defvar mail-mode-map nil)
 
+(autoload 'build-mail-aliases "mailalias"
+  "Read mail aliases from `~/.mailrc' and set `mail-aliases'."
+  nil)
+
+(autoload 'expand-mail-aliases "mailalias"
+  "Expand all mail aliases in suitable header fields found between BEG and END.
+Suitable header fields are `To', `Cc' and `Bcc' and their `Resent-' variants.
+Optional second arg EXCLUDE may be a regular expression defining text to be
+removed from alias expansions."
+  nil)
+
 ;;;###autoload
 (defvar mail-signature nil
   "*Text inserted at end of mail buffer when a message is initialized.
@@ -92,8 +107,12 @@
      (modify-syntax-entry ?% ". " mail-mode-syntax-table)))
 
 (defun mail-setup (to subject in-reply-to cc replybuffer actions)
+  (if (eq mail-aliases t)
+      (progn
+	(setq mail-aliases nil)
+	(if (file-exists-p "~/.mailrc")
+	    (build-mail-aliases))))
   (setq mail-send-actions actions)
-  (mail-aliases-setup)
   (setq mail-reply-buffer replybuffer)
   (goto-char (point-min))
   (insert "To: ")
@@ -251,6 +270,8 @@
 	  (replace-match "\n")
 	  (backward-char 1)
 	  (setq delimline (point-marker))
+	  (if mail-aliases
+	      (expand-mail-aliases (point-min) delimline))
 	  (goto-char (point-min))
 	  ;; ignore any blank lines in the header
 	  (while (and (re-search-forward "\n\n\n*" delimline t)