diff options
| author | Gerd Moellmann | 2001-05-08 11:17:27 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-05-08 11:17:27 +0000 |
| commit | 6b59a5fc117af9f47711044330add39400d8fdda (patch) | |
| tree | 6029e58a0cc094f8b601fa37205b24e51e3ae98b | |
| parent | a2a6232ec1d172c9bd708aae287876a853655f3f (diff) | |
| download | emacs-6b59a5fc117af9f47711044330add39400d8fdda.tar.gz emacs-6b59a5fc117af9f47711044330add39400d8fdda.zip | |
(rmail-insert-mime-forwarded-message-function)
(rmail-search-mime-message-function)
(rmail-search-mime-header-function): New variables.
(rmail-expunge-and-save): Be sure to set-buffer to the Rmail
buffer.
(rmail-quit): Bury `rmail-buffer' after `rmail-view-buffer' is
hidden.
(rmail-get-new-mail): Likewise.
(rmail-toggle-header): Likewise. If rmail-enable-mime is non-nil,
call rmai-show-mime-function.
(rmail-display-labels): If rmail-enable-mime is non-nil, update
mode-line-process of rmail-view-buffer.
(rmail-set-attribute): Be sure to set-buffer to the Rmail buffer.
(rmail-show-message): Be sure to call rmail-auto-file in the Rmail
buffer.
(rmail-next-message): Be sure to set-buffer to the Rmail buffer.
(rmail-next-undeleted-message): Likewise.
(rmail-message-regexp-p): If rmail-enable-mime is non-nil, call
rmail-search-mime-header-function.
(rmail-search-message): New function.
(rmail-search): Call rmail-search-message to check if a message
matches REGEXP, lastly update point after calling
rmail-show-message.
(rmail-undelete-previous-message): Be sure to set-buffer to the
Rmail buffer.
(rmail-expunge-confirmed): Likewise.
(rmail-only-expunge): Likewise.
(rmail-reply): If rmail-enable-mime is non-nil, don't narrow to
header region, refer to rmail-msgref-vector while setting the
current buffer to rmail-buffer temporarily.
(rmail-forward): Be sure to bind forward-buffer to the Rmail
buffer. If rmail-enable-mime is non-nil, call
rmail-insert-mime-forwarded-message-function instead of inserting
forwarded message by itself.
| -rw-r--r-- | lisp/mail/rmail.el | 199 |
1 files changed, 140 insertions, 59 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 0e012f21611..aae9af2bcaf 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -419,7 +419,33 @@ until a user explicitly requires it." | |||
| 419 | 419 | ||
| 420 | ;;;###autoload | 420 | ;;;###autoload |
| 421 | (defvar rmail-show-mime-function nil | 421 | (defvar rmail-show-mime-function nil |
| 422 | "Function to show MIME decoded message of RMAIL file.") | 422 | "Function to show MIME decoded message of RMAIL file. |
| 423 | This function is called when `rmail-enable-mime' is non-nil. | ||
| 424 | It is called with no argument.") | ||
| 425 | |||
| 426 | ;;;###autoload | ||
| 427 | (defvar rmail-insert-mime-forwarded-message-function nil | ||
| 428 | "Function to insert a message in MIME format so it can be forwarded. | ||
| 429 | This function is called if `rmail-enable-mime' is non-nil. | ||
| 430 | It is called with one argument FORWARD-BUFFER, which is a | ||
| 431 | buffer containing the message to forward. The current buffer | ||
| 432 | is the outgoing mail buffer.") | ||
| 433 | |||
| 434 | ;;;###autoload | ||
| 435 | (defvar rmail-search-mime-message-function nil | ||
| 436 | "Function to check if a regexp matches a MIME message. | ||
| 437 | This function is called if `rmail-enable-mime' is non-nil. | ||
| 438 | It is called with two arguments MSG and REGEXP, where | ||
| 439 | MSG is the message number, REGEXP is the regular expression.") | ||
| 440 | |||
| 441 | ;;;###autoload | ||
| 442 | (defvar rmail-search-mime-header-function nil | ||
| 443 | "Function to check if a regexp matches a header of MIME message. | ||
| 444 | This function is called if `rmail-enable-mime' is non-nil. | ||
| 445 | It is called with four arguments MSG, REGEXP, and LIMIT, where | ||
| 446 | MSG is the message number, | ||
| 447 | REGEXP is the regular expression, | ||
| 448 | LIMIT is the position specifying the end of header.") | ||
| 423 | 449 | ||
| 424 | ;;;###autoload | 450 | ;;;###autoload |
| 425 | (defvar rmail-mime-feature 'rmail-mime | 451 | (defvar rmail-mime-feature 'rmail-mime |
| @@ -1103,6 +1129,7 @@ Instead, these commands are available: | |||
| 1103 | "Expunge and save RMAIL file." | 1129 | "Expunge and save RMAIL file." |
| 1104 | (interactive) | 1130 | (interactive) |
| 1105 | (rmail-expunge) | 1131 | (rmail-expunge) |
| 1132 | (set-buffer rmail-buffer) | ||
| 1106 | (save-buffer) | 1133 | (save-buffer) |
| 1107 | (if (rmail-summary-exists) | 1134 | (if (rmail-summary-exists) |
| 1108 | (rmail-select-summary (set-buffer-modified-p nil)))) | 1135 | (rmail-select-summary (set-buffer-modified-p nil)))) |
| @@ -1118,9 +1145,17 @@ Hook `rmail-quit-hook' is run after expunging." | |||
| 1118 | (when rmail-summary-buffer | 1145 | (when rmail-summary-buffer |
| 1119 | (replace-buffer-in-windows rmail-summary-buffer) | 1146 | (replace-buffer-in-windows rmail-summary-buffer) |
| 1120 | (bury-buffer rmail-summary-buffer)) | 1147 | (bury-buffer rmail-summary-buffer)) |
| 1121 | (let ((obuf (current-buffer))) | 1148 | (if rmail-enable-mime |
| 1122 | (quit-window) | 1149 | (let ((obuf rmail-buffer) |
| 1123 | (replace-buffer-in-windows obuf))) | 1150 | (ovbuf rmail-view-buffer)) |
| 1151 | (set-buffer rmail-view-buffer) | ||
| 1152 | (quit-window) | ||
| 1153 | (replace-buffer-in-windows ovbuf) | ||
| 1154 | (replace-buffer-in-windows obuf) | ||
| 1155 | (bury-buffer obuf)) | ||
| 1156 | (let ((obuf (current-buffer))) | ||
| 1157 | (quit-window) | ||
| 1158 | (replace-buffer-in-windows obuf)))) | ||
| 1124 | 1159 | ||
| 1125 | (defun rmail-bury () | 1160 | (defun rmail-bury () |
| 1126 | "Bury current Rmail buffer and its summary buffer." | 1161 | "Bury current Rmail buffer and its summary buffer." |
| @@ -1256,6 +1291,7 @@ It returns t if it got any new messages." | |||
| 1256 | ;; revert to it before we get new mail. | 1291 | ;; revert to it before we get new mail. |
| 1257 | (or (verify-visited-file-modtime (current-buffer)) | 1292 | (or (verify-visited-file-modtime (current-buffer)) |
| 1258 | (find-file (buffer-file-name))) | 1293 | (find-file (buffer-file-name))) |
| 1294 | (set-buffer rmail-buffer) | ||
| 1259 | (rmail-maybe-set-message-counters) | 1295 | (rmail-maybe-set-message-counters) |
| 1260 | (widen) | 1296 | (widen) |
| 1261 | ;; Get rid of all undo records for this buffer. | 1297 | ;; Get rid of all undo records for this buffer. |
| @@ -1880,6 +1916,7 @@ Otherwise, delete all header fields whose names match `rmail-ignored-headers'." | |||
| 1880 | With argument ARG, show the message header pruned if ARG is greater than zero; | 1916 | With argument ARG, show the message header pruned if ARG is greater than zero; |
| 1881 | otherwise, show it in full." | 1917 | otherwise, show it in full." |
| 1882 | (interactive "P") | 1918 | (interactive "P") |
| 1919 | (switch-to-buffer rmail-buffer) | ||
| 1883 | (let* ((buffer-read-only nil) | 1920 | (let* ((buffer-read-only nil) |
| 1884 | (pruned (rmail-msg-is-pruned)) | 1921 | (pruned (rmail-msg-is-pruned)) |
| 1885 | (prune (if arg | 1922 | (prune (if arg |
| @@ -1925,7 +1962,9 @@ otherwise, show it in full." | |||
| 1925 | ;; Narrow to after the new EOOH line. | 1962 | ;; Narrow to after the new EOOH line. |
| 1926 | (narrow-to-region new-start (point-max))) | 1963 | (narrow-to-region new-start (point-max))) |
| 1927 | (rmail-reformat-message (point-min) (point-max)))) | 1964 | (rmail-reformat-message (point-min) (point-max)))) |
| 1928 | (cond (at-point-min | 1965 | (cond (rmail-enable-mime |
| 1966 | (funcall rmail-show-mime-function)) | ||
| 1967 | (at-point-min | ||
| 1929 | (goto-char (point-min))) | 1968 | (goto-char (point-min))) |
| 1930 | (on-header | 1969 | (on-header |
| 1931 | (goto-char (point-min)) | 1970 | (goto-char (point-min)) |
| @@ -2003,12 +2042,21 @@ otherwise, show it in full." | |||
| 2003 | (substring blurb (match-end 0))))) | 2042 | (substring blurb (match-end 0))))) |
| 2004 | (setq mode-line-process | 2043 | (setq mode-line-process |
| 2005 | (format " %d/%d%s" | 2044 | (format " %d/%d%s" |
| 2006 | rmail-current-message rmail-total-messages blurb)))) | 2045 | rmail-current-message rmail-total-messages blurb)) |
| 2046 | ;; If rmail-enable-mime is non-nil, we may have to update | ||
| 2047 | ;; `mode-line-process' of rmail-view-buffer too. | ||
| 2048 | (if (and rmail-enable-mime | ||
| 2049 | (not (eq (current-buffer) rmail-view-buffer)) | ||
| 2050 | (buffer-live-p rmail-view-buffer)) | ||
| 2051 | (let ((mlp mode-line-process)) | ||
| 2052 | (with-current-buffer rmail-view-buffer | ||
| 2053 | (setq mode-line-process mlp)))))) | ||
| 2007 | 2054 | ||
| 2008 | ;; Turn an attribute of a message on or off according to STATE. | 2055 | ;; Turn an attribute of a message on or off according to STATE. |
| 2009 | ;; ATTR is the name of the attribute, as a string. | 2056 | ;; ATTR is the name of the attribute, as a string. |
| 2010 | ;; MSGNUM is message number to change; nil means current message. | 2057 | ;; MSGNUM is message number to change; nil means current message. |
| 2011 | (defun rmail-set-attribute (attr state &optional msgnum) | 2058 | (defun rmail-set-attribute (attr state &optional msgnum) |
| 2059 | (set-buffer rmail-buffer) | ||
| 2012 | (let ((omax (point-max-marker)) | 2060 | (let ((omax (point-max-marker)) |
| 2013 | (omin (point-min-marker)) | 2061 | (omin (point-min-marker)) |
| 2014 | (buffer-read-only nil)) | 2062 | (buffer-read-only nil)) |
| @@ -2277,7 +2325,8 @@ If summary buffer is currently displayed, update current message there also." | |||
| 2277 | (let ((curr-msg rmail-current-message)) | 2325 | (let ((curr-msg rmail-current-message)) |
| 2278 | (rmail-select-summary | 2326 | (rmail-select-summary |
| 2279 | (rmail-summary-goto-msg curr-msg t t)))) | 2327 | (rmail-summary-goto-msg curr-msg t t)))) |
| 2280 | (rmail-auto-file) | 2328 | (with-current-buffer rmail-buffer |
| 2329 | (rmail-auto-file)) | ||
| 2281 | (if blurb | 2330 | (if blurb |
| 2282 | (message blurb)))))) | 2331 | (message blurb)))))) |
| 2283 | 2332 | ||
| @@ -2423,6 +2472,7 @@ Called when a new message is displayed." | |||
| 2423 | "Show following message whether deleted or not. | 2472 | "Show following message whether deleted or not. |
| 2424 | With prefix arg N, moves forward N messages, or backward if N is negative." | 2473 | With prefix arg N, moves forward N messages, or backward if N is negative." |
| 2425 | (interactive "p") | 2474 | (interactive "p") |
| 2475 | (set-buffer rmail-buffer) | ||
| 2426 | (rmail-maybe-set-message-counters) | 2476 | (rmail-maybe-set-message-counters) |
| 2427 | (rmail-show-message (+ rmail-current-message n))) | 2477 | (rmail-show-message (+ rmail-current-message n))) |
| 2428 | 2478 | ||
| @@ -2439,6 +2489,7 @@ or backward if N is negative. | |||
| 2439 | 2489 | ||
| 2440 | Returns t if a new message is being shown, nil otherwise." | 2490 | Returns t if a new message is being shown, nil otherwise." |
| 2441 | (interactive "p") | 2491 | (interactive "p") |
| 2492 | (set-buffer rmail-buffer) | ||
| 2442 | (rmail-maybe-set-message-counters) | 2493 | (rmail-maybe-set-message-counters) |
| 2443 | (let ((lastwin rmail-current-message) | 2494 | (let ((lastwin rmail-current-message) |
| 2444 | (current rmail-current-message)) | 2495 | (current rmail-current-message)) |
| @@ -2523,7 +2574,16 @@ or forward if N is negative." | |||
| 2523 | (search-forward "\n*** EOOH ***\n" end t) | 2574 | (search-forward "\n*** EOOH ***\n" end t) |
| 2524 | (setq end (1+ (match-beginning 0))))) | 2575 | (setq end (1+ (match-beginning 0))))) |
| 2525 | (goto-char beg) | 2576 | (goto-char beg) |
| 2526 | (re-search-forward regexp end t)))) | 2577 | (if rmail-enable-mime |
| 2578 | (funcall rmail-search-mime-header-function n regexp end) | ||
| 2579 | (re-search-forward regexp end t))))) | ||
| 2580 | |||
| 2581 | (defun rmail-search-message (msg regexp) | ||
| 2582 | "Return non-nil, if for message number MSG, regexp REGEXP matches." | ||
| 2583 | (goto-char (rmail-msgbeg msg)) | ||
| 2584 | (if rmail-enable-mime | ||
| 2585 | (funcall rmail-search-mime-message-function msg regexp) | ||
| 2586 | (re-search-forward regexp (rmail-msgend msg) t))) | ||
| 2527 | 2587 | ||
| 2528 | (defvar rmail-search-last-regexp nil) | 2588 | (defvar rmail-search-last-regexp nil) |
| 2529 | (defun rmail-search (regexp &optional n) | 2589 | (defun rmail-search (regexp &optional n) |
| @@ -2552,6 +2612,7 @@ Interactively, empty argument means use same regexp used last time." | |||
| 2552 | (message "%sRmail search for %s..." | 2612 | (message "%sRmail search for %s..." |
| 2553 | (if (< n 0) "Reverse " "") | 2613 | (if (< n 0) "Reverse " "") |
| 2554 | regexp) | 2614 | regexp) |
| 2615 | (set-buffer rmail-buffer) | ||
| 2555 | (rmail-maybe-set-message-counters) | 2616 | (rmail-maybe-set-message-counters) |
| 2556 | (let ((omin (point-min)) | 2617 | (let ((omin (point-min)) |
| 2557 | (omax (point-max)) | 2618 | (omax (point-max)) |
| @@ -2567,28 +2628,30 @@ Interactively, empty argument means use same regexp used last time." | |||
| 2567 | ;; but searching forward through each message. | 2628 | ;; but searching forward through each message. |
| 2568 | (if reversep | 2629 | (if reversep |
| 2569 | (while (and (null win) (> msg 1)) | 2630 | (while (and (null win) (> msg 1)) |
| 2570 | (goto-char (rmail-msgbeg (setq msg (1- msg)))) | 2631 | (setq msg (1- msg) |
| 2571 | (setq win (re-search-forward | 2632 | win (rmail-search-message msg regexp))) |
| 2572 | regexp (rmail-msgend msg) t))) | ||
| 2573 | (while (and (null win) (< msg rmail-total-messages)) | 2633 | (while (and (null win) (< msg rmail-total-messages)) |
| 2574 | (goto-char (rmail-msgbeg (setq msg (1+ msg)))) | 2634 | (setq msg (1+ msg) |
| 2575 | (setq win (re-search-forward regexp (rmail-msgend msg) t)))) | 2635 | win (rmail-search-message msg regexp)))) |
| 2576 | (setq n (+ n (if reversep 1 -1))))) | 2636 | (setq n (+ n (if reversep 1 -1))))) |
| 2577 | (if win | 2637 | (if win |
| 2578 | (progn | 2638 | (progn |
| 2579 | ;; If this is a reverse search and we found a message, | 2639 | (rmail-show-message msg) |
| 2580 | ;; search backward thru this message to position point. | 2640 | ;; Search forward (if this is a normal search) or backward |
| 2641 | ;; (if this is a reverse search) through this message to | ||
| 2642 | ;; position point. This search may fail because REGEXP | ||
| 2643 | ;; was found in the hidden portion of this message. In | ||
| 2644 | ;; that case, move point to the beginning of visible | ||
| 2645 | ;; portion. | ||
| 2581 | (if reversep | 2646 | (if reversep |
| 2582 | (progn | 2647 | (progn |
| 2583 | (goto-char (rmail-msgend msg)) | 2648 | (goto-char (point-max)) |
| 2584 | (re-search-backward | 2649 | (re-search-backward regexp nil 'move)) |
| 2585 | regexp (rmail-msgbeg msg) t))) | 2650 | (goto-char (point-min)) |
| 2586 | (setq win (point-marker)) | 2651 | (re-search-forward regexp nil t)) |
| 2587 | (rmail-show-message msg) | ||
| 2588 | (message "%sRmail search for %s...done" | 2652 | (message "%sRmail search for %s...done" |
| 2589 | (if reversep "Reverse " "") | 2653 | (if reversep "Reverse " "") |
| 2590 | regexp) | 2654 | regexp)) |
| 2591 | (goto-char win)) | ||
| 2592 | (goto-char opoint) | 2655 | (goto-char opoint) |
| 2593 | (narrow-to-region omin omax) | 2656 | (narrow-to-region omin omax) |
| 2594 | (ding) | 2657 | (ding) |
| @@ -2704,6 +2767,7 @@ If N is negative, go forwards instead." | |||
| 2704 | (defun rmail-undelete-previous-message () | 2767 | (defun rmail-undelete-previous-message () |
| 2705 | "Back up to deleted message, select it, and undelete it." | 2768 | "Back up to deleted message, select it, and undelete it." |
| 2706 | (interactive) | 2769 | (interactive) |
| 2770 | (set-buffer rmail-buffer) | ||
| 2707 | (let ((msg rmail-current-message)) | 2771 | (let ((msg rmail-current-message)) |
| 2708 | (while (and (> msg 0) | 2772 | (while (and (> msg 0) |
| 2709 | (not (rmail-message-deleted-p msg))) | 2773 | (not (rmail-message-deleted-p msg))) |
| @@ -2759,6 +2823,7 @@ Deleted messages stay in the file until the \\[rmail-expunge] command is given." | |||
| 2759 | (defun rmail-expunge-confirmed () | 2823 | (defun rmail-expunge-confirmed () |
| 2760 | "Return t if deleted message should be expunged. If necessary, ask the user. | 2824 | "Return t if deleted message should be expunged. If necessary, ask the user. |
| 2761 | See also user-option `rmail-confirm-expunge'." | 2825 | See also user-option `rmail-confirm-expunge'." |
| 2826 | (set-buffer rmail-buffer) | ||
| 2762 | (or (not (stringp rmail-deleted-vector)) | 2827 | (or (not (stringp rmail-deleted-vector)) |
| 2763 | (not (string-match "D" rmail-deleted-vector)) | 2828 | (not (string-match "D" rmail-deleted-vector)) |
| 2764 | (null rmail-confirm-expunge) | 2829 | (null rmail-confirm-expunge) |
| @@ -2768,6 +2833,7 @@ See also user-option `rmail-confirm-expunge'." | |||
| 2768 | (defun rmail-only-expunge () | 2833 | (defun rmail-only-expunge () |
| 2769 | "Actually erase all deleted messages in the file." | 2834 | "Actually erase all deleted messages in the file." |
| 2770 | (interactive) | 2835 | (interactive) |
| 2836 | (set-buffer rmail-buffer) | ||
| 2771 | (message "Expunging deleted messages...") | 2837 | (message "Expunging deleted messages...") |
| 2772 | ;; Discard all undo records for this buffer. | 2838 | ;; Discard all undo records for this buffer. |
| 2773 | (or (eq buffer-undo-list t) | 2839 | (or (eq buffer-undo-list t) |
| @@ -2778,7 +2844,10 @@ See also user-option `rmail-confirm-expunge'." | |||
| 2778 | (opoint (if (and (> rmail-current-message 0) | 2844 | (opoint (if (and (> rmail-current-message 0) |
| 2779 | (rmail-message-deleted-p rmail-current-message)) | 2845 | (rmail-message-deleted-p rmail-current-message)) |
| 2780 | 0 | 2846 | 0 |
| 2781 | (- (point) (point-min)))) | 2847 | (if rmail-enable-mime |
| 2848 | (with-current-buffer rmail-view-buffer | ||
| 2849 | (- (point)(point-min))) | ||
| 2850 | (- (point) (point-min))))) | ||
| 2782 | (messages-head (cons (aref rmail-message-vector 0) nil)) | 2851 | (messages-head (cons (aref rmail-message-vector 0) nil)) |
| 2783 | (messages-tail messages-head) | 2852 | (messages-tail messages-head) |
| 2784 | ;; Don't make any undo records for the expunging. | 2853 | ;; Don't make any undo records for the expunging. |
| @@ -2842,7 +2911,9 @@ See also user-option `rmail-confirm-expunge'." | |||
| 2842 | (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax))) | 2911 | (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax))) |
| 2843 | (rmail-show-message | 2912 | (rmail-show-message |
| 2844 | (if (zerop rmail-current-message) 1 nil)) | 2913 | (if (zerop rmail-current-message) 1 nil)) |
| 2845 | (goto-char (+ (point) opoint))))) | 2914 | (if rmail-enable-mime |
| 2915 | (goto-char (+ (point-min) opoint)) | ||
| 2916 | (goto-char (+ (point) opoint)))))) | ||
| 2846 | 2917 | ||
| 2847 | (defun rmail-expunge () | 2918 | (defun rmail-expunge () |
| 2848 | "Erase deleted messages from Rmail file and summary buffer." | 2919 | "Erase deleted messages from Rmail file and summary buffer." |
| @@ -2901,19 +2972,24 @@ use \\[mail-yank-original] to yank the original message into it." | |||
| 2901 | (msgnum rmail-current-message)) | 2972 | (msgnum rmail-current-message)) |
| 2902 | (save-excursion | 2973 | (save-excursion |
| 2903 | (save-restriction | 2974 | (save-restriction |
| 2904 | (widen) | 2975 | ;; If rmail-enable-mime is non-nil, we are in a |
| 2905 | (goto-char (rmail-msgbeg rmail-current-message)) | 2976 | ;; rmail-view-buffer which doesn't contain any lines specific |
| 2906 | (forward-line 1) | 2977 | ;; to BABYL format (e.g. "*** EOOH ***"). Thus, there's no |
| 2907 | (if (= (following-char) ?0) | 2978 | ;; need of narrowing in such a case. |
| 2908 | (narrow-to-region | 2979 | (unless rmail-enable-mime |
| 2909 | (progn (forward-line 2) | 2980 | (widen) |
| 2910 | (point)) | 2981 | (goto-char (rmail-msgbeg rmail-current-message)) |
| 2911 | (progn (search-forward "\n\n" (rmail-msgend rmail-current-message) | 2982 | (forward-line 1) |
| 2912 | 'move) | 2983 | (if (= (following-char) ?0) |
| 2913 | (point))) | 2984 | (narrow-to-region |
| 2914 | (narrow-to-region (point) | 2985 | (progn (forward-line 2) |
| 2915 | (progn (search-forward "\n*** EOOH ***\n") | 2986 | (point)) |
| 2916 | (beginning-of-line) (point)))) | 2987 | (progn (search-forward "\n\n" (rmail-msgend rmail-current-message) |
| 2988 | 'move) | ||
| 2989 | (point))) | ||
| 2990 | (narrow-to-region (point) | ||
| 2991 | (progn (search-forward "\n*** EOOH ***\n") | ||
| 2992 | (beginning-of-line) (point))))) | ||
| 2917 | (setq from (mail-fetch-field "from") | 2993 | (setq from (mail-fetch-field "from") |
| 2918 | reply-to (or (mail-fetch-field "reply-to" nil t) | 2994 | reply-to (or (mail-fetch-field "reply-to" nil t) |
| 2919 | from) | 2995 | from) |
| @@ -2968,8 +3044,9 @@ use \\[mail-yank-original] to yank the original message into it." | |||
| 2968 | (if (string= cc-list "") nil cc-list))) | 3044 | (if (string= cc-list "") nil cc-list))) |
| 2969 | rmail-view-buffer | 3045 | rmail-view-buffer |
| 2970 | (list (list 'rmail-mark-message | 3046 | (list (list 'rmail-mark-message |
| 2971 | rmail-view-buffer | 3047 | rmail-buffer |
| 2972 | (aref rmail-msgref-vector msgnum) | 3048 | (with-current-buffer rmail-buffer |
| 3049 | (aref rmail-msgref-vector msgnum)) | ||
| 2973 | "answered")) | 3050 | "answered")) |
| 2974 | nil | 3051 | nil |
| 2975 | (list (cons "References" (concat (mapconcat 'identity references " ") | 3052 | (list (cons "References" (concat (mapconcat 'identity references " ") |
| @@ -3051,7 +3128,7 @@ see the documentation of `rmail-resend'." | |||
| 3051 | (interactive "P") | 3128 | (interactive "P") |
| 3052 | (if resend | 3129 | (if resend |
| 3053 | (call-interactively 'rmail-resend) | 3130 | (call-interactively 'rmail-resend) |
| 3054 | (let ((forward-buffer (current-buffer)) | 3131 | (let ((forward-buffer rmail-buffer) |
| 3055 | (msgnum rmail-current-message) | 3132 | (msgnum rmail-current-message) |
| 3056 | (subject (concat "[" | 3133 | (subject (concat "[" |
| 3057 | (let ((from (or (mail-fetch-field "From") | 3134 | (let ((from (or (mail-fetch-field "From") |
| @@ -3065,7 +3142,8 @@ see the documentation of `rmail-resend'." | |||
| 3065 | nil nil subject nil nil nil | 3142 | nil nil subject nil nil nil |
| 3066 | (list (list 'rmail-mark-message | 3143 | (list (list 'rmail-mark-message |
| 3067 | forward-buffer | 3144 | forward-buffer |
| 3068 | (aref rmail-msgref-vector msgnum) | 3145 | (with-current-buffer rmail-buffer |
| 3146 | (aref rmail-msgref-vector msgnum)) | ||
| 3069 | "forwarded")) | 3147 | "forwarded")) |
| 3070 | ;; If only one window, use it for the mail buffer. | 3148 | ;; If only one window, use it for the mail buffer. |
| 3071 | ;; Otherwise, use another window for the mail buffer | 3149 | ;; Otherwise, use another window for the mail buffer |
| @@ -3076,24 +3154,27 @@ see the documentation of `rmail-resend'." | |||
| 3076 | (save-excursion | 3154 | (save-excursion |
| 3077 | ;; Insert after header separator--before signature if any. | 3155 | ;; Insert after header separator--before signature if any. |
| 3078 | (goto-char (mail-text-start)) | 3156 | (goto-char (mail-text-start)) |
| 3079 | (insert "------- Start of forwarded message -------\n") | 3157 | (if rmail-enable-mime |
| 3080 | ;; Quote lines with `- ' if they start with `-'. | 3158 | (funcall rmail-insert-mime-forwarded-message-function |
| 3081 | (let ((beg (point)) end) | 3159 | forward-buffer) |
| 3082 | (setq end (point-marker)) | 3160 | (insert "------- Start of forwarded message -------\n") |
| 3083 | (set-marker-insertion-type end t) | 3161 | ;; Quote lines with `- ' if they start with `-'. |
| 3084 | (insert-buffer-substring forward-buffer) | 3162 | (let ((beg (point)) end) |
| 3085 | (goto-char beg) | 3163 | (setq end (point-marker)) |
| 3086 | (while (re-search-forward "^-" end t) | 3164 | (set-marker-insertion-type end t) |
| 3087 | (beginning-of-line) | 3165 | (insert-buffer-substring forward-buffer) |
| 3088 | (insert "- ") | 3166 | (goto-char beg) |
| 3089 | (forward-line 1)) | 3167 | (while (re-search-forward "^-" end t) |
| 3090 | (goto-char end) | 3168 | (beginning-of-line) |
| 3091 | (skip-chars-backward "\n") | 3169 | (insert "- ") |
| 3092 | (if (< (point) end) | 3170 | (forward-line 1)) |
| 3093 | (forward-char 1)) | 3171 | (goto-char end) |
| 3094 | (delete-region (point) end) | 3172 | (skip-chars-backward "\n") |
| 3095 | (set-marker end nil)) | 3173 | (if (< (point) end) |
| 3096 | (insert "------- End of forwarded message -------\n") | 3174 | (forward-char 1)) |
| 3175 | (delete-region (point) end) | ||
| 3176 | (set-marker end nil)) | ||
| 3177 | (insert "------- End of forwarded message -------\n")) | ||
| 3097 | (push-mark)))))) | 3178 | (push-mark)))))) |
| 3098 | 3179 | ||
| 3099 | (defun rmail-resend (address &optional from comment mail-alias-file) | 3180 | (defun rmail-resend (address &optional from comment mail-alias-file) |