diff options
Diffstat (limited to 'lisp/mail')
| -rw-r--r-- | lisp/mail/emacsbug.el | 3 | ||||
| -rw-r--r-- | lisp/mail/mailabbrev.el | 29 | ||||
| -rw-r--r-- | lisp/mail/mailalias.el | 32 | ||||
| -rw-r--r-- | lisp/mail/rmail.el | 6 | ||||
| -rw-r--r-- | lisp/mail/sendmail.el | 22 |
5 files changed, 37 insertions, 55 deletions
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 061fd30ee39..f65e665d051 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -27,8 +27,9 @@ (defvar bug-gnu-emacs "bug-gnu-emacs@prep.ai.mit.edu" "Address of site maintaining mailing list for GNU Emacs bugs.") +;;;###autoload (defun report-emacs-bug (topic) - "Report a bug in Gnu emacs. + "Report a bug in GNU Emacs. Prompts for bug subject. Leaves you in a mail buffer." (interactive "sBug Subject: ") (mail nil bug-gnu-emacs topic) diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el index ef9ab8cea0e..5efa9eadd4b 100644 --- a/lisp/mail/mailabbrev.el +++ b/lisp/mail/mailabbrev.el @@ -120,11 +120,12 @@ ;; originally defined in sendmail.el - used to be an alist, now is a table. (defvar mail-aliases nil - "Word-abbrev table of mail address aliases. + "Abbrev table of mail address aliases. If this is nil, it means the aliases have not yet been initialized and should be read from the .mailrc file. (This is distinct from there being no aliases, which is represented by this being a table with no entries.)") +;;;###autoload (defun mail-aliases-setup () (if (and (not (vectorp mail-aliases)) (file-exists-p (mail-abbrev-mailrc-file))) @@ -217,6 +218,7 @@ also want something like \",\\n \" to get each address on its own line.") ;; originally defined in mailalias.el ; build-mail-aliases calls this with ;; stuff parsed from the .mailrc file. ;; +;;;###autoload (defun define-mail-alias (name definition &optional from-mailrc-file) "Define NAME as a mail-alias that translates to DEFINITION. If DEFINITION contains multiple addresses, seperate them with commas." @@ -295,10 +297,9 @@ If DEFINITION contains multiple addresses, seperate them with commas." (defun mail-abbrev-expand-hook () - "For use as the fourth arg to define-abbrev. - After expanding a mail-abbrev, if fill-mode is on and we're past the -fill-column, break the line at the previous comma, and indent the next -line." + "For use as the fourth arg to `define-abbrev'. +After expanding a mail alias, if Auto Fill mode is on and we're past the +fill column, break the line at the previous comma, and indent the next line." (save-excursion (let ((p (point)) bol) @@ -337,7 +338,7 @@ This should be set to match those mail fields in which you want abbreviations turned on.") (defvar mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table) - "The syntax table which is current in send-mail mode.") + "The syntax table which is current in mail mode.") (defvar mail-mode-header-syntax-table (let ((tab (copy-syntax-table text-mode-syntax-table))) @@ -362,7 +363,9 @@ turned on.") "The syntax table used when the cursor is in a mail-address header. mail-mode-syntax-table is used when the cursor is not in an address header.") - +;; This hook is run before trying to expand an abbrev in a mail buffer. +;; It determines whether point is in the header, and chooses which +;; abbrev table accordingly. (defun sendmail-pre-abbrev-expand-hook () (if mail-abbrev-aliases-need-to-be-resolved (mail-resolve-all-aliases)) @@ -425,17 +428,5 @@ mail-mode-syntax-table is used when the cursor is not in an address header.") (setq mail-aliases nil) (build-mail-aliases file)) - -;;; Patching it in: -;;; Remove the entire file mailalias.el -;;; Remove the definition of mail-aliases from sendmail.el -;;; Add a call to mail-aliases-setup to mail-setup in sendmail.el -;;; Remove the call to expand-mail-aliases from sendmail-send-it in sendmail.el -;;; Remove the autoload of expand-mail-aliases from sendmail.el -;;; Remove the autoload of build-mail-aliases from sendmail.el -;;; Add an autoload of define-mail-alias - -(fmakunbound 'expand-mail-aliases) - (provide 'mail-abbrevs) diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el index 7201d0182e7..2765bd561f0 100644 --- a/lisp/mail/mailalias.el +++ b/lisp/mail/mailalias.el @@ -142,17 +142,27 @@ DEFINITION can be one or more mail addresses separated by commas." (setq mail-aliases nil) (if (file-exists-p "~/.mailrc") (build-mail-aliases)))) - (let (tem) - ;; ~/.mailrc contains addresses separated by spaces. - ;; mailers should expect addresses separated by commas. - (while (setq tem (string-match "[^ \t,][ \t,]+" definition tem)) - (if (= (match-end 0) (length definition)) - (setq definition (substring definition 0 (1+ tem))) - (setq definition (concat (substring definition - 0 (1+ tem)) - ", " - (substring definition (match-end 0)))) - (setq tem (+ 3 tem)))) + ;; Strip leading and trailing blanks. + (if (string-match "^[ \t]+" definition) + (setq definition (substring definition (match-end 0)))) + (if (string-match "[ \t]+$" definition) + (setq definition (substring definition 0 (match-beginning 0)))) + (let ((first (aref definition 0)) + (last (aref definition (1- (length definition)))) + tem) + (if (and (= first last) (memq first '(?\' ?\"))) + ;; Strip quotation marks. + (setq definition (substring definition 1 (1- (length definition)))) + ;; ~/.mailrc contains addresses separated by spaces. + ;; mailers should expect addresses separated by commas. + (while (setq tem (string-match "[^ \t,][ \t,]+" definition tem)) + (if (= (match-end 0) (length definition)) + (setq definition (substring definition 0 (1+ tem))) + (setq definition (concat (substring definition + 0 (1+ tem)) + ", " + (substring definition (match-end 0)))) + (setq tem (+ 3 tem))))) (setq tem (assoc name mail-aliases)) (if tem (rplacd tem definition) diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index fcb55c90dd9..8c966ce9604 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1,5 +1,5 @@ ;; "RMAIL" mail reader for Emacs. -;; Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1988, 1991 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -638,7 +638,7 @@ argument causes us to read a file name and use that file as the inbox." (concat "^[\^_]?\\(" "From [^ \n]*\\(\\|\".*\"[^ \n]*\\) ?[^ \n]* [^ \n]* *" "[0-9]* [0-9:]*\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) " ; EDT, -0500 - "19[0-9]* *\\(remote from [^\n]*\\)?$\\|" + "[0-9]+ *\\(remote from [^\n]*\\)?$\\|" mmdf-delim1 "\\|" "^BABYL OPTIONS:\\|" "\^L\n[01],\\)") nil t) @@ -684,7 +684,7 @@ argument causes us to read a file name and use that file as the inbox." (goto-char start)) (let ((case-fold-search nil)) (if (re-search-forward - "^From \\([^ ]*\\(\\|\".*\"[^ ]*\\)\\) ?\\([^ ]*\\) \\([^ ]*\\) *\\([0-9]*\\) \\([0-9:]*\\)\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) 19\\([0-9]*\\) *\\(remote from [^\n]*\\)?\n" nil t) + "^From \\([^ ]*\\(\\|\".*\"[^ ]*\\)\\) ?\\([^ ]*\\) \\([^ ]*\\) *\\([0-9]*\\) \\([0-9:]*\\)\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) [0-9][0-9]\\([0-9]*\\) *\\(remote from [^\n]*\\)?\n" nil t) (replace-match (concat "Mail-from: \\&" diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index dbb8fc8d5a1..709f4d880a7 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -50,11 +50,6 @@ The headers are be delimited by a line which is mail-header-separator.") *Name of file to write all outgoing messages in, or nil for none. Do not use an rmail file here! Instead, use its inbox file.") -;;;###autoload -(defvar mail-aliases t "\ -Alias of mail address aliases, -or t meaning should be initialized from .mailrc.") - (defvar mail-default-reply-to nil "*Address to insert as default Reply-to field of outgoing messages.") @@ -92,22 +87,9 @@ so you can edit or delete these lines.") (setq mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table)) (modify-syntax-entry ?% ". " mail-mode-syntax-table))) -(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." - nil) - (defun mail-setup (to subject in-reply-to cc replybuffer actions) (setq mail-send-actions actions) - (if (eq mail-aliases t) - (progn - (setq mail-aliases nil) - (if (file-exists-p "~/.mailrc") - (build-mail-aliases)))) + (mail-aliases-setup) (setq mail-reply-buffer replybuffer) (goto-char (point-min)) (insert "To: ") @@ -258,8 +240,6 @@ the user from the mailer." (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) |
