comparison lisp/mail/rmail.el @ 37956:b59847354241

(rmail-revert): Modify to work in rmail-view-buffer. (rmail-insert-mime-resent-message-function): New variable. (rmail-resend): Modify to work in `rmail-view-buffer'; call `rmail-insert-mime-resent-message-function' if `rmail-enable-mime' is non-nil.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 31 May 2001 08:09:12 +0000
parents aac3e63d5361
children 6eaa11a41f8a
comparison
equal deleted inserted replaced
37955:e1400bd914f0 37956:b59847354241
424 It is called with no argument.") 424 It is called with no argument.")
425 425
426 ;;;###autoload 426 ;;;###autoload
427 (defvar rmail-insert-mime-forwarded-message-function nil 427 (defvar rmail-insert-mime-forwarded-message-function nil
428 "Function to insert a message in MIME format so it can be forwarded. 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-insert-mime-resent-message-function nil
436 "Function to insert a message in MIME format so it can be resent.
429 This function is called if `rmail-enable-mime' is non-nil. 437 This function is called if `rmail-enable-mime' is non-nil.
430 It is called with one argument FORWARD-BUFFER, which is a 438 It is called with one argument FORWARD-BUFFER, which is a
431 buffer containing the message to forward. The current buffer 439 buffer containing the message to forward. The current buffer
432 is the outgoing mail buffer.") 440 is the outgoing mail buffer.")
433 441
1108 (make-local-variable 'file-precious-flag) 1116 (make-local-variable 'file-precious-flag)
1109 (setq file-precious-flag t)) 1117 (setq file-precious-flag t))
1110 1118
1111 ;; Handle M-x revert-buffer done in an rmail-mode buffer. 1119 ;; Handle M-x revert-buffer done in an rmail-mode buffer.
1112 (defun rmail-revert (arg noconfirm) 1120 (defun rmail-revert (arg noconfirm)
1121 (set-buffer rmail-buffer)
1113 (let* ((revert-buffer-function (default-value 'revert-buffer-function)) 1122 (let* ((revert-buffer-function (default-value 'revert-buffer-function))
1114 (rmail-enable-multibyte enable-multibyte-characters) 1123 (rmail-enable-multibyte enable-multibyte-characters)
1115 ;; See similar code in `rmail'. 1124 ;; See similar code in `rmail'.
1116 (coding-system-for-read (and rmail-enable-multibyte 'raw-text))) 1125 (coding-system-for-read (and rmail-enable-multibyte 'raw-text)))
1117 ;; Call our caller again, but this time it does the default thing. 1126 ;; Call our caller again, but this time it does the default thing.
1118 (if (revert-buffer arg noconfirm) 1127 (if (revert-buffer arg noconfirm)
1119 ;; If the user said "yes", and we changed something, 1128 ;; If the user said "yes", and we changed something,
1120 ;; reparse the messages. 1129 ;; reparse the messages.
1121 (progn 1130 (progn
1122 (rmail-mode-2) 1131 (set-buffer rmail-buffer)
1132 (rmail-mode-2)
1123 ;; Convert all or part to Babyl file if possible. 1133 ;; Convert all or part to Babyl file if possible.
1124 (rmail-convert-file) 1134 (rmail-convert-file)
1125 ;; We have read the file as raw-text, so the buffer is set to 1135 ;; We have read the file as raw-text, so the buffer is set to
1126 ;; unibyte. Make it multibyte if necessary. 1136 ;; unibyte. Make it multibyte if necessary.
1127 (if (and rmail-enable-multibyte 1137 (if (and rmail-enable-multibyte
3213 Optional ALIAS-FILE is alternate aliases file to be used by sendmail, 3223 Optional ALIAS-FILE is alternate aliases file to be used by sendmail,
3214 typically for purposes of moderating a list." 3224 typically for purposes of moderating a list."
3215 (interactive "sResend to: ") 3225 (interactive "sResend to: ")
3216 (require 'sendmail) 3226 (require 'sendmail)
3217 (require 'mailalias) 3227 (require 'mailalias)
3218 (unless (eq rmail-buffer (current-buffer)) 3228 (unless (or (eq rmail-view-buffer (current-buffer))
3229 (eq rmail-buffer (current-buffer)))
3219 (error "Not an Rmail buffer")) 3230 (error "Not an Rmail buffer"))
3220 (if (not from) (setq from user-mail-address)) 3231 (if (not from) (setq from user-mail-address))
3221 (let ((tembuf (generate-new-buffer " sendmail temp")) 3232 (let ((tembuf (generate-new-buffer " sendmail temp"))
3222 (case-fold-search nil) 3233 (case-fold-search nil)
3223 (mailbuf rmail-buffer)) 3234 (mailbuf rmail-buffer))
3224 (unwind-protect 3235 (unwind-protect
3225 (with-current-buffer tembuf 3236 (with-current-buffer tembuf
3226 ;;>> Copy message into temp buffer 3237 ;;>> Copy message into temp buffer
3227 (insert-buffer-substring mailbuf) 3238 (if rmail-enable-mime
3239 (funcall rmail-insert-mime-resent-message-function mailbuf)
3240 (insert-buffer-substring mailbuf))
3228 (goto-char (point-min)) 3241 (goto-char (point-min))
3229 ;; Delete any Sender field, since that's not specifiable. 3242 ;; Delete any Sender field, since that's not specifiable.
3230 ; Only delete Sender fields in the actual header. 3243 ; Only delete Sender fields in the actual header.
3231 (re-search-forward "^$" nil 'move) 3244 (re-search-forward "^$" nil 'move)
3232 ; Using "while" here rather than "if" because some buggy mail 3245 ; Using "while" here rather than "if" because some buggy mail