aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-09-23 04:37:16 +0000
committerRichard M. Stallman1994-09-23 04:37:16 +0000
commit3db0cdac4986393dab7978ef2a31deb4daee6a11 (patch)
tree87169ad7446384ff6ff27d04d39c186e9f735c26
parent78608595650c2428069026304d2d24cdb7d1f838 (diff)
downloademacs-3db0cdac4986393dab7978ef2a31deb4daee6a11.tar.gz
emacs-3db0cdac4986393dab7978ef2a31deb4daee6a11.zip
(rmail-retry-failure): Copy the whole block of headers from the message
and then discard those in rmail-retry-ignored-headers. Delete usage of rmail-retry-setup-hook. Bind mail-signature and mail-setup-hook to nil when composing retry buffer. Handle mail-self-blind. (rmail-retry-ignored-headers): New variable, specifying the headers that should be removed by rmail-retry-failure. (rmail-retry-setup-hook): Obsolete variable (see below), deleted. (rmail-clear-headers): New optional arg is list of headers to clear.
-rw-r--r--lisp/mail/rmail.el69
1 files changed, 39 insertions, 30 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 2d446716b2e..a039dea4cdb 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -67,12 +67,16 @@ value is the user's name.)
67It is useful to set this variable in the site customization file.") 67It is useful to set this variable in the site customization file.")
68 68
69;;;###autoload 69;;;###autoload
70(defvar rmail-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|\ 70(defvar rmail-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^received:\\|^x400-originator:\\|^x400-recipients:\\|^x400-received:\\|^x400-mts-identifier:\\|^x400-content-type:\\|^\\(resent-\\|\\)message-id:\\|^summary-line:" "\
71^received:\\|^x400-originator:\\|^x400-recipients:\\|^x400-received:\\|\ 71^received:\\|^x400-originator:\\|^x400-recipients:\\|^x400-received:\\|\
72^x400-mts-identifier:\\|^x400-content-type:\\|^message-id:\\|^summary-line:" 72^x400-mts-identifier:\\|^x400-content-type:\\|^message-id:\\|^summary-line:"
73 "*Regexp to match Header fields that Rmail should normally hide.") 73 "*Regexp to match Header fields that Rmail should normally hide.")
74 74
75;;;###autoload 75;;;###autoload
76(defvar rmail-retry-ignored-headers nil "\
77*Headers that should be stripped when retrying a failed message.")
78
79;;;###autoload
76(defvar rmail-highlighted-headers "^From:\\|^Subject:" "\ 80(defvar rmail-highlighted-headers "^From:\\|^Subject:" "\
77*Regexp to match Header fields that Rmail should normally highlight. 81*Regexp to match Header fields that Rmail should normally highlight.
78A value of nil means don't highlight. 82A value of nil means don't highlight.
@@ -98,10 +102,6 @@ and the value of the environment variable MAIL overrides it).")
98 "*Non-nil means Rmail makes a new frame for composing outgoing mail.") 102 "*Non-nil means Rmail makes a new frame for composing outgoing mail.")
99 103
100;;;###autoload 104;;;###autoload
101(defvar rmail-retry-setup-hook nil
102 "Hook that `rmail-retry-failure' uses in place of `mail-setup-hook'.")
103
104;;;###autoload
105(defvar rmail-secondary-file-directory "~/" 105(defvar rmail-secondary-file-directory "~/"
106 "*Directory for additional secondary Rmail files.") 106 "*Directory for additional secondary Rmail files.")
107;;;###autoload 107;;;###autoload
@@ -1165,14 +1165,15 @@ This function runs `rmail-get-new-mail-hook' before saving the updated file."
1165 (if rmail-ignored-headers (rmail-clear-headers)) 1165 (if rmail-ignored-headers (rmail-clear-headers))
1166 (if rmail-message-filter (funcall rmail-message-filter)))) 1166 (if rmail-message-filter (funcall rmail-message-filter))))
1167 1167
1168(defun rmail-clear-headers () 1168(defun rmail-clear-headers (&optional ignored-headers)
1169 (or ignored-headers (setq ignored-headers rmail-ignored-headers))
1169 (if (search-forward "\n\n" nil t) 1170 (if (search-forward "\n\n" nil t)
1170 (save-restriction 1171 (save-restriction
1171 (narrow-to-region (point-min) (point)) 1172 (narrow-to-region (point-min) (point))
1172 (let ((buffer-read-only nil)) 1173 (let ((buffer-read-only nil))
1173 (while (let ((case-fold-search t)) 1174 (while (let ((case-fold-search t))
1174 (goto-char (point-min)) 1175 (goto-char (point-min))
1175 (re-search-forward rmail-ignored-headers nil t)) 1176 (re-search-forward ignored-headers nil t))
1176 (beginning-of-line) 1177 (beginning-of-line)
1177 (delete-region (point) 1178 (delete-region (point)
1178 (progn (re-search-forward "\n[^ \t]") 1179 (progn (re-search-forward "\n[^ \t]")
@@ -2150,10 +2151,12 @@ typically for purposes of moderating a list."
2150For a message rejected by the mail system, extract the interesting headers and 2151For a message rejected by the mail system, extract the interesting headers and
2151the body of the original message. 2152the body of the original message.
2152The variable `mail-unsent-separator' should match the string that 2153The variable `mail-unsent-separator' should match the string that
2153delimits the returned original message." 2154delimits the returned original message.
2155The variable `rmail-retry-ignored-headers' is a regular expression
2156specifying headers which should not be copied into the new message."
2154 (interactive) 2157 (interactive)
2155 (require 'mail-utils) 2158 (require 'mail-utils)
2156 (let (to subj irp2 cc orig-message) 2159 (let (mail-buffer bounce-start bounce-end resending)
2157 (save-excursion 2160 (save-excursion
2158 ;; Narrow down to just the quoted original message 2161 ;; Narrow down to just the quoted original message
2159 (rmail-beginning-of-message) 2162 (rmail-beginning-of-message)
@@ -2170,33 +2173,39 @@ delimits the returned original message."
2170 (progn 2173 (progn
2171 (search-forward "\n\n") 2174 (search-forward "\n\n")
2172 (skip-chars-forward "\n"))) 2175 (skip-chars-forward "\n")))
2176 (beginning-of-line)
2173 (narrow-to-region (point) (point-max)) 2177 (narrow-to-region (point) (point-max))
2174 (goto-char (point-min)) 2178 (setq mail-buffer (current-buffer)
2175 (search-forward "\n\n") 2179 bounce-start (point)
2176 (narrow-to-region (point-min) (point)) 2180 bounce-end (point-max))
2177 ;; Now mail-fetch-field will get from headers of the original message, 2181 (or (search-forward "\n\n" nil t)
2178 ;; not from the headers of the rejection. 2182 (error "Cannot find end of header in failed message")))))
2179 (setq to (mail-fetch-field "To")
2180 subj (mail-fetch-field "Subject")
2181 irp2 (mail-fetch-field "In-reply-to")
2182 cc (mail-fetch-field "Cc"))
2183 ;; Get the entire text (not headers) of the original message.
2184 (goto-char (point-max))
2185 (widen)
2186 (setq orig-message
2187 (buffer-substring (point) old-end)))))
2188 ;; Start sending a new message; default header fields from the original. 2183 ;; Start sending a new message; default header fields from the original.
2189 ;; Turn off the usual actions for initializing the message body 2184 ;; Turn off the usual actions for initializing the message body
2190 ;; because we want to get only the text from the failure message. 2185 ;; because we want to get only the text from the failure message.
2191 (let (mail-signature 2186 (let (mail-signature mail-setup-hook)
2192 (mail-setup-hook rmail-retry-setup-hook)) 2187 (if (rmail-start-mail nil nil nil nil nil mail-buffer)
2193 (if (rmail-start-mail nil to subj irp2 cc (current-buffer))
2194 ;; Insert original text as initial text of new draft message. 2188 ;; Insert original text as initial text of new draft message.
2195 (progn 2189 (progn
2196 (goto-char (point-max)) 2190 (erase-buffer)
2197 (insert orig-message) 2191 (insert-buffer-substring mail-buffer bounce-start bounce-end)
2192 (goto-char (point-min))
2193 (rmail-clear-headers rmail-retry-ignored-headers)
2194 (rmail-clear-headers "^sender:")
2198 (goto-char (point-min)) 2195 (goto-char (point-min))
2199 (end-of-line)))))) 2196 (save-restriction
2197 (search-forward "\n\n")
2198 (forward-line -1)
2199 (narrow-to-region (point-min) (point))
2200 (setq resending (mail-fetch-field "resent-to"))
2201 (if mail-self-blind
2202 (if resending
2203 (insert "Resent-Bcc: " (user-login-name) "\n")
2204 (insert "BCC: " (user-login-name) "\n"))))
2205 (insert mail-header-separator)
2206 (mail-position-on-field (if resending "Resent-To" "To") t)
2207 (set-buffer mail-buffer)
2208 (rmail-beginning-of-message))))))
2200 2209
2201(defun rmail-bury () 2210(defun rmail-bury ()
2202 "Bury current Rmail buffer and its summary buffer." 2211 "Bury current Rmail buffer and its summary buffer."