Mercurial > emacs
comparison lisp/mail/rmail.el @ 13808:308a47d72b19
(rmail-ignored-headers): Add resent-date, nntp-posting-host.
(rmail-retry-failure): Fix previous change.
Combine variables mail-buffer and rmail-buffer.
Look for an end-delimiter in case where the start-of-bounce
delimiter looks like -- plus some more text.
(rmail-search): Doc fix.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 21 Dec 1995 18:02:18 +0000 |
parents | 36e3cc8cb103 |
children | 0d1de22afac0 |
comparison
equal
deleted
inserted
replaced
13807:2042acfaf58b | 13808:308a47d72b19 |
---|---|
65 `rmail-dont-reply-to-names' explicitly. (The other part of the default | 65 `rmail-dont-reply-to-names' explicitly. (The other part of the default |
66 value is the user's name.) | 66 value is the user's name.) |
67 It is useful to set this variable in the site customization file.") | 67 It 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:\\|^received:\\|^x400-originator:\\|^x400-recipients:\\|^x400-received:\\|^x400-mts-identifier:\\|^x400-content-type:\\|^\\(resent-\\|\\)message-id:\\|^summary-line:" | 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:\\|^resent-date:\\|^nntp-posting-host:" |
71 "*Regexp to match Header fields that Rmail should normally hide.") | 71 "*Regexp to match Header fields that Rmail should normally hide.") |
72 | 72 |
73 ;;;###autoload | 73 ;;;###autoload |
74 (defvar rmail-displayed-headers nil | 74 (defvar rmail-displayed-headers nil |
75 "*Regexp to match Header fields that Rmail should display. | 75 "*Regexp to match Header fields that Rmail should display. |
1725 (search-forward "*** EOOH ***" (point-max)) (point)))) | 1725 (search-forward "*** EOOH ***" (point-max)) (point)))) |
1726 (re-search-forward regexp end t))) | 1726 (re-search-forward regexp end t))) |
1727 | 1727 |
1728 (defvar rmail-search-last-regexp nil) | 1728 (defvar rmail-search-last-regexp nil) |
1729 (defun rmail-search (regexp &optional n) | 1729 (defun rmail-search (regexp &optional n) |
1730 "Show message containing next match for REGEXP. | 1730 "Show message containing next match for REGEXP (but not the current msg). |
1731 Prefix argument gives repeat count; negative argument means search | 1731 Prefix argument gives repeat count; negative argument means search |
1732 backwards (through earlier messages). | 1732 backwards (through earlier messages). |
1733 Interactively, empty argument means use same regexp used last time." | 1733 Interactively, empty argument means use same regexp used last time." |
1734 (interactive | 1734 (interactive |
1735 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0)) | 1735 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0)) |
2365 delimits the returned original message. | 2365 delimits the returned original message. |
2366 The variable `rmail-retry-ignored-headers' is a regular expression | 2366 The variable `rmail-retry-ignored-headers' is a regular expression |
2367 specifying headers which should not be copied into the new message." | 2367 specifying headers which should not be copied into the new message." |
2368 (interactive) | 2368 (interactive) |
2369 (require 'mail-utils) | 2369 (require 'mail-utils) |
2370 (let (mail-buffer bounce-start bounce-end bounce-indent resending) | 2370 (let ((rmail-buffer (current-buffer)) |
2371 (msgnum rmail-current-message) | |
2372 bounce-start bounce-end bounce-indent resending) | |
2371 (save-excursion | 2373 (save-excursion |
2372 ;; Narrow down to just the quoted original message | 2374 ;; Narrow down to just the quoted original message |
2373 (rmail-beginning-of-message) | 2375 (rmail-beginning-of-message) |
2374 (let ((case-fold-search t)) | 2376 (let ((case-fold-search t)) |
2375 (if (search-forward "This is a MIME-encapsulated message\n\n--" nil t) | 2377 (if (search-forward "This is a MIME-encapsulated message\n\n--" nil t) |
2376 (let ((codestring | 2378 (let ((codestring |
2377 (buffer-substring (progn (beginning-of-line) (point)) | 2379 (buffer-substring (progn (beginning-of-line) (point)) |
2378 (progn (end-of-line) (point))))) | 2380 (progn (end-of-line) (point))))) |
2379 (re-search-forward mail-unsent-separator) | 2381 (re-search-forward mail-unsent-separator) |
2380 (setq mail-buffer (current-buffer)) | |
2381 (search-forward codestring) | 2382 (search-forward codestring) |
2382 (or (search-forward "\n\n" nil t) | 2383 (or (search-forward "\n\n" nil t) |
2383 (error "Cannot find end of Mime data in failed message")) | 2384 (error "Cannot find end of Mime data in failed message")) |
2384 (setq bounce-start (point)) | 2385 (setq bounce-start (point)) |
2385 (save-excursion | 2386 (save-excursion |
2402 (goto-char (point-max)) | 2403 (goto-char (point-max)) |
2403 (re-search-backward "^End of returned message$" nil t) | 2404 (re-search-backward "^End of returned message$" nil t) |
2404 (setq bounce-end (point))) | 2405 (setq bounce-end (point))) |
2405 ;; One message contained a few random lines before the old | 2406 ;; One message contained a few random lines before the old |
2406 ;; message header. The first line of the message started with | 2407 ;; message header. The first line of the message started with |
2407 ;; two hyphens. A blank line follows these random lines. | 2408 ;; two hyphens. A blank line followed these random lines. |
2409 ;; The same line beginning with two hyphens was possibly | |
2410 ;; marking the end of the message. | |
2408 (if (looking-at "^--") | 2411 (if (looking-at "^--") |
2409 (progn | 2412 (let ((boundary (buffer-substring-no-properties |
2413 (point) | |
2414 (progn (end-of-line) (point))))) | |
2410 (search-forward "\n\n") | 2415 (search-forward "\n\n") |
2411 (skip-chars-forward "\n"))) | 2416 (skip-chars-forward "\n") |
2412 (setq bounce-start (point) | 2417 (setq bounce-start (point)) |
2413 bounce-end (point-max)) | 2418 (goto-char (point-max)) |
2419 (search-backward (concat "\n\n" boundary) bounce-start t) | |
2420 (setq bounce-end (point))) | |
2421 (setq bounce-start (point) | |
2422 bounce-end (point-max))) | |
2414 (or (search-forward "\n\n" nil t) | 2423 (or (search-forward "\n\n" nil t) |
2415 (error "Cannot find end of header in failed message"))) | 2424 (error "Cannot find end of header in failed message")) |
2416 (setq mail-buffer (current-buffer))))) | 2425 )))) |
2417 ;; Start sending a new message; default header fields from the original. | 2426 ;; Start sending a new message; default header fields from the original. |
2418 ;; Turn off the usual actions for initializing the message body | 2427 ;; Turn off the usual actions for initializing the message body |
2419 ;; because we want to get only the text from the failure message. | 2428 ;; because we want to get only the text from the failure message. |
2420 (let (mail-signature mail-setup-hook) | 2429 (let ((action |
2421 (if (rmail-start-mail nil nil nil nil nil mail-buffer) | 2430 ;; This function will be called when the user sends the retry. |
2431 ;; It will mark the bounce message as "retried". | |
2432 (function (lambda () | |
2433 (let ((msgnum rmail-send-actions-rmail-msg-number)) | |
2434 (save-excursion | |
2435 (set-buffer rmail-send-actions-rmail-buffer) | |
2436 (if msgnum | |
2437 (rmail-set-attribute "retried" t msgnum))))))) | |
2438 mail-signature mail-setup-hook) | |
2439 (if (rmail-start-mail nil nil nil nil nil rmail-buffer | |
2440 (list (list action))) | |
2422 ;; Insert original text as initial text of new draft message. | 2441 ;; Insert original text as initial text of new draft message. |
2423 (progn | 2442 (progn |
2443 ;; We keep the rmail buffer and message number in these | |
2444 ;; buffer-local vars in the sendmail buffer, | |
2445 ;; so that the rmail-only-expunge can relocate the message number. | |
2446 (make-local-variable 'rmail-send-actions-rmail-buffer) | |
2447 (make-local-variable 'rmail-send-actions-rmail-msg-number) | |
2448 (setq rmail-send-actions-rmail-buffer rmail-buffer) | |
2449 (setq rmail-send-actions-rmail-msg-number msgnum) | |
2424 (erase-buffer) | 2450 (erase-buffer) |
2425 (insert-buffer-substring mail-buffer bounce-start bounce-end) | 2451 (insert-buffer-substring rmail-buffer bounce-start bounce-end) |
2426 (goto-char (point-min)) | 2452 (goto-char (point-min)) |
2427 (if bounce-indent | 2453 (if bounce-indent |
2428 (indent-rigidly (point-min) (point-max) bounce-indent)) | 2454 (indent-rigidly (point-min) (point-max) bounce-indent)) |
2429 (rmail-clear-headers rmail-retry-ignored-headers) | 2455 (rmail-clear-headers rmail-retry-ignored-headers) |
2430 (rmail-clear-headers "^sender:\\|^from:\\|^return-path:") | 2456 (rmail-clear-headers "^sender:\\|^from:\\|^return-path:") |
2438 (if resending | 2464 (if resending |
2439 (insert "Resent-Bcc: " (user-login-name) "\n") | 2465 (insert "Resent-Bcc: " (user-login-name) "\n") |
2440 (insert "BCC: " (user-login-name) "\n")))) | 2466 (insert "BCC: " (user-login-name) "\n")))) |
2441 (insert mail-header-separator) | 2467 (insert mail-header-separator) |
2442 (mail-position-on-field (if resending "Resent-To" "To") t) | 2468 (mail-position-on-field (if resending "Resent-To" "To") t) |
2443 (set-buffer mail-buffer) | 2469 (set-buffer rmail-buffer) |
2444 (rmail-beginning-of-message)))))) | 2470 (rmail-beginning-of-message)))))) |
2445 | 2471 |
2446 (defun rmail-summary-exists () | 2472 (defun rmail-summary-exists () |
2447 "Non-nil iff in an RMAIL buffer and an associated summary buffer exists. | 2473 "Non-nil iff in an RMAIL buffer and an associated summary buffer exists. |
2448 In fact, the non-nil value returned is the summary buffer itself." | 2474 In fact, the non-nil value returned is the summary buffer itself." |