diff options
| author | Richard M. Stallman | 2001-03-06 03:19:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-03-06 03:19:14 +0000 |
| commit | b926081f869615fd2e0f606596bb071c2ced6ff6 (patch) | |
| tree | 58e0fbebaff04bfa224611ad2a38b40088d47a6d /lisp | |
| parent | fda3411db76315fc636e9191f6d0fbf2ce7c88d9 (diff) | |
| download | emacs-b926081f869615fd2e0f606596bb071c2ced6ff6.tar.gz emacs-b926081f869615fd2e0f606596bb071c2ced6ff6.zip | |
(rmail-retry-failure): Don't call rmail-beginning-of-message.
Don't discard From: field. Do discard Received: field.
Use unwind-protect to re-prune.
(rmail-retry-ignored-headers): Discard X-Authentication-Warning field.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/mail/rmail.el | 207 |
1 files changed, 105 insertions, 102 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 05d509e0284..4909a4cb956 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -173,7 +173,7 @@ If nil, display all header fields except those matched by | |||
| 173 | :group 'rmail-headers) | 173 | :group 'rmail-headers) |
| 174 | 174 | ||
| 175 | ;;;###autoload | 175 | ;;;###autoload |
| 176 | (defcustom rmail-retry-ignored-headers nil "\ | 176 | (defcustom rmail-retry-ignored-headers "^x-authentication-warning:" "\ |
| 177 | *Headers that should be stripped when retrying a failed message." | 177 | *Headers that should be stripped when retrying a failed message." |
| 178 | :type '(choice regexp (const nil :tag "None")) | 178 | :type '(choice regexp (const nil :tag "None")) |
| 179 | :group 'rmail-headers) | 179 | :group 'rmail-headers) |
| @@ -3197,107 +3197,110 @@ specifying headers which should not be copied into the new message." | |||
| 3197 | (msgnum rmail-current-message) | 3197 | (msgnum rmail-current-message) |
| 3198 | (pruned (rmail-msg-is-pruned)) | 3198 | (pruned (rmail-msg-is-pruned)) |
| 3199 | bounce-start bounce-end bounce-indent resending) | 3199 | bounce-start bounce-end bounce-indent resending) |
| 3200 | (save-excursion | 3200 | (unwind-protect |
| 3201 | ;; Narrow down to just the quoted original message | 3201 | (progn |
| 3202 | (rmail-beginning-of-message) | 3202 | (save-excursion |
| 3203 | (if pruned | 3203 | ;; Un-prune the header; we need to search the whole thing. |
| 3204 | (rmail-toggle-header 0)) | 3204 | (if pruned |
| 3205 | (let* ((case-fold-search t) | 3205 | (rmail-toggle-header 0)) |
| 3206 | (top (point)) | 3206 | (goto-char (rmail-msgbeg msgnum)) |
| 3207 | (content-type | 3207 | (let* ((case-fold-search t) |
| 3208 | (save-restriction | 3208 | (top (point)) |
| 3209 | ;; Fetch any content-type header in current message | 3209 | (content-type |
| 3210 | (search-forward "\n\n") (narrow-to-region top (point)) | 3210 | (save-restriction |
| 3211 | (mail-fetch-field "Content-Type") )) ) | 3211 | ;; Fetch any content-type header in current message |
| 3212 | ;; Handle MIME multipart bounce messages | 3212 | (search-forward "\n\n") (narrow-to-region top (point)) |
| 3213 | (if (and content-type | 3213 | (mail-fetch-field "Content-Type") )) ) |
| 3214 | (string-match | 3214 | ;; Handle MIME multipart bounce messages |
| 3215 | ";[\n\t ]*boundary=\"?\\([-0-9a-z'()+_,./:=? ]+\\)\"?" | 3215 | (if (and content-type |
| 3216 | content-type)) | 3216 | (string-match |
| 3217 | (let ((codestring | 3217 | ";[\n\t ]*boundary=\"?\\([-0-9a-z'()+_,./:=? ]+\\)\"?" |
| 3218 | (concat "\n--" | 3218 | content-type)) |
| 3219 | (substring content-type (match-beginning 1) | 3219 | (let ((codestring |
| 3220 | (match-end 1))))) | 3220 | (concat "\n--" |
| 3221 | (or (re-search-forward mail-mime-unsent-header nil t) | 3221 | (substring content-type (match-beginning 1) |
| 3222 | (error "Cannot find beginning of header in failed message")) | 3222 | (match-end 1))))) |
| 3223 | (or (search-forward "\n\n" nil t) | 3223 | (unless (re-search-forward mail-mime-unsent-header nil t) |
| 3224 | (error "Cannot find start of Mime data in failed message")) | 3224 | (error "Cannot find beginning of header in failed message")) |
| 3225 | (setq bounce-start (point)) | 3225 | (unless (search-forward "\n\n" nil t) |
| 3226 | (if (search-forward codestring nil t) | 3226 | (error "Cannot find start of Mime data in failed message")) |
| 3227 | (setq bounce-end (match-beginning 0)) | 3227 | (setq bounce-start (point)) |
| 3228 | (setq bounce-end (point-max))) | 3228 | (if (search-forward codestring nil t) |
| 3229 | ) | 3229 | (setq bounce-end (match-beginning 0)) |
| 3230 | ;; non-MIME bounce | 3230 | (setq bounce-end (point-max))) |
| 3231 | (or (re-search-forward mail-unsent-separator nil t) | 3231 | ) |
| 3232 | (error "Cannot parse this as a failure message")) | 3232 | ;; non-MIME bounce |
| 3233 | (skip-chars-forward "\n") | 3233 | (or (re-search-forward mail-unsent-separator nil t) |
| 3234 | ;; Support a style of failure message in which the original | 3234 | (error "Cannot parse this as a failure message")) |
| 3235 | ;; message is indented, and included within lines saying | 3235 | (skip-chars-forward "\n") |
| 3236 | ;; `Start of returned message' and `End of returned message'. | 3236 | ;; Support a style of failure message in which the original |
| 3237 | (if (looking-at " +Received:") | 3237 | ;; message is indented, and included within lines saying |
| 3238 | (progn | 3238 | ;; `Start of returned message' and `End of returned message'. |
| 3239 | (setq bounce-start (point)) | 3239 | (if (looking-at " +Received:") |
| 3240 | (skip-chars-forward " ") | 3240 | (progn |
| 3241 | (setq bounce-indent (- (current-column))) | 3241 | (setq bounce-start (point)) |
| 3242 | (goto-char (point-max)) | 3242 | (skip-chars-forward " ") |
| 3243 | (re-search-backward "^End of returned message$" nil t) | 3243 | (setq bounce-indent (- (current-column))) |
| 3244 | (setq bounce-end (point))) | 3244 | (goto-char (point-max)) |
| 3245 | ;; One message contained a few random lines before the old | 3245 | (re-search-backward "^End of returned message$" nil t) |
| 3246 | ;; message header. The first line of the message started with | 3246 | (setq bounce-end (point))) |
| 3247 | ;; two hyphens. A blank line followed these random lines. | 3247 | ;; One message contained a few random lines before |
| 3248 | ;; The same line beginning with two hyphens was possibly | 3248 | ;; the old message header. The first line of the |
| 3249 | ;; marking the end of the message. | 3249 | ;; message started with two hyphens. A blank line |
| 3250 | (if (looking-at "^--") | 3250 | ;; followed these random lines. The same line |
| 3251 | (let ((boundary (buffer-substring-no-properties | 3251 | ;; beginning with two hyphens was possibly marking |
| 3252 | (point) | 3252 | ;; the end of the message. |
| 3253 | (progn (end-of-line) (point))))) | 3253 | (if (looking-at "^--") |
| 3254 | (search-forward "\n\n") | 3254 | (let ((boundary (buffer-substring-no-properties |
| 3255 | (skip-chars-forward "\n") | 3255 | (point) |
| 3256 | (setq bounce-start (point)) | 3256 | (progn (end-of-line) (point))))) |
| 3257 | (goto-char (point-max)) | 3257 | (search-forward "\n\n") |
| 3258 | (search-backward (concat "\n\n" boundary) bounce-start t) | 3258 | (skip-chars-forward "\n") |
| 3259 | (setq bounce-end (point))) | 3259 | (setq bounce-start (point)) |
| 3260 | (setq bounce-start (point) | 3260 | (goto-char (point-max)) |
| 3261 | bounce-end (point-max))) | 3261 | (search-backward (concat "\n\n" boundary) bounce-start t) |
| 3262 | (or (search-forward "\n\n" nil t) | 3262 | (setq bounce-end (point))) |
| 3263 | (error "Cannot find end of header in failed message")) | 3263 | (setq bounce-start (point) |
| 3264 | )))) | 3264 | bounce-end (point-max))) |
| 3265 | ;; Start sending a new message; default header fields from the original. | 3265 | (unless (search-forward "\n\n" nil t) |
| 3266 | ;; Turn off the usual actions for initializing the message body | 3266 | (error "Cannot find end of header in failed message")) |
| 3267 | ;; because we want to get only the text from the failure message. | 3267 | )))) |
| 3268 | (let (mail-signature mail-setup-hook) | 3268 | ;; Start sending new message; default header fields from original. |
| 3269 | (if (rmail-start-mail nil nil nil nil nil rmail-this-buffer | 3269 | ;; Turn off the usual actions for initializing the message body |
| 3270 | (list (list 'rmail-mark-message | 3270 | ;; because we want to get only the text from the failure message. |
| 3271 | rmail-this-buffer | 3271 | (let (mail-signature mail-setup-hook) |
| 3272 | (aref rmail-msgref-vector msgnum) | 3272 | (if (rmail-start-mail nil nil nil nil nil rmail-this-buffer |
| 3273 | "retried"))) | 3273 | (list (list 'rmail-mark-message |
| 3274 | ;; Insert original text as initial text of new draft message. | 3274 | rmail-this-buffer |
| 3275 | ;; Bind inhibit-read-only since the header delimiter | 3275 | (aref rmail-msgref-vector msgnum) |
| 3276 | ;; of the previous message was probably read-only. | 3276 | "retried"))) |
| 3277 | (let ((inhibit-read-only t) | 3277 | ;; Insert original text as initial text of new draft message. |
| 3278 | rmail-displayed-headers | 3278 | ;; Bind inhibit-read-only since the header delimiter |
| 3279 | rmail-ignored-headers) | 3279 | ;; of the previous message was probably read-only. |
| 3280 | (erase-buffer) | 3280 | (let ((inhibit-read-only t) |
| 3281 | (insert-buffer-substring rmail-this-buffer bounce-start bounce-end) | 3281 | rmail-displayed-headers |
| 3282 | (goto-char (point-min)) | 3282 | rmail-ignored-headers) |
| 3283 | (if bounce-indent | 3283 | (erase-buffer) |
| 3284 | (indent-rigidly (point-min) (point-max) bounce-indent)) | 3284 | (insert-buffer-substring rmail-this-buffer |
| 3285 | (rmail-clear-headers rmail-retry-ignored-headers) | 3285 | bounce-start bounce-end) |
| 3286 | (rmail-clear-headers "^sender:\\|^from:\\|^return-path:") | 3286 | (goto-char (point-min)) |
| 3287 | (mail-sendmail-delimit-header) | 3287 | (if bounce-indent |
| 3288 | (save-restriction | 3288 | (indent-rigidly (point-min) (point-max) bounce-indent)) |
| 3289 | (narrow-to-region (point-min) (mail-header-end)) | 3289 | (rmail-clear-headers rmail-retry-ignored-headers) |
| 3290 | (setq resending (mail-fetch-field "resent-to")) | 3290 | (rmail-clear-headers "^sender:\\|^return-path:\\|^received:") |
| 3291 | (if mail-self-blind | 3291 | (mail-sendmail-delimit-header) |
| 3292 | (if resending | 3292 | (save-restriction |
| 3293 | (insert "Resent-Bcc: " (user-login-name) "\n") | 3293 | (narrow-to-region (point-min) (mail-header-end)) |
| 3294 | (insert "BCC: " (user-login-name) "\n")))) | 3294 | (setq resending (mail-fetch-field "resent-to")) |
| 3295 | (goto-char (point-min)) | 3295 | (if mail-self-blind |
| 3296 | (mail-position-on-field (if resending "Resent-To" "To") t) | 3296 | (if resending |
| 3297 | (set-buffer rmail-this-buffer) | 3297 | (insert "Resent-Bcc: " (user-login-name) "\n") |
| 3298 | (rmail-beginning-of-message)))) | 3298 | (insert "BCC: " (user-login-name) "\n")))) |
| 3299 | (if pruned | 3299 | (goto-char (point-min)) |
| 3300 | (rmail-toggle-header)))) | 3300 | (mail-position-on-field (if resending "Resent-To" "To") t))))) |
| 3301 | (with-current-buffer rmail-this-buffer | ||
| 3302 | (if pruned | ||
| 3303 | (rmail-toggle-header 1)))))) | ||
| 3301 | 3304 | ||
| 3302 | (defun rmail-summary-exists () | 3305 | (defun rmail-summary-exists () |
| 3303 | "Non-nil iff in an RMAIL buffer and an associated summary buffer exists. | 3306 | "Non-nil iff in an RMAIL buffer and an associated summary buffer exists. |