(require (quote rmail))

(defvar rmail-edit-map nil)

(if rmail-edit-map nil (setq rmail-edit-map (copy-keymap text-mode-map)) (define-key rmail-edit-map "" (quote rmail-cease-edit)) (define-key rmail-edit-map "" (quote rmail-abort-edit)))

(put (quote rmail-edit-mode) (quote mode-class) (quote special))

(defun rmail-edit-mode nil "\
Major mode for editing the contents of an RMAIL message.
The editing commands are the same as in Text mode, together with two commands
to return to regular RMAIL:
  *  rmail-abort-edit cancels the changes
     you have made and returns to RMAIL
  *  rmail-cease-edit makes them permanent.
\\{rmail-edit-map}" (byte-code "!Ɖlj!!!\"" [rmail-edit-map major-mode mode-name mode-line-modified mode-line-format use-local-map rmail-edit-mode "RMAIL Edit" boundp default-value run-hooks text-mode-hook rmail-edit-mode-hook] 7))

(defun rmail-edit-current-message nil "\
Edit the contents of this message." (interactive) (byte-code "ˆ !ed\"‰ !!=&!=/!4!!" [rmail-old-text buffer-read-only nil rmail-edit-mode make-local-variable buffer-substring set-buffer-modified-p buffer-modified-p key-binding "" rmail-cease-edit "" rmail-abort-edit message "Editing: Type C-c C-c to return to Rmail, C-c C-] to abort" substitute-command-keys "Editing: Type \\[rmail-cease-edit] to return to Rmail, \\[rmail-abort-edit] to abort"] 11))

(defun rmail-cease-edit nil "\
Finish editing message; switch back to Rmail proper." (interactive) (byte-code "Ĉdbh\"c	TH`\") ! 
ed\"\":ĂXĉ\"!X	SI! ))ʼn" [rmail-message-vector rmail-current-message old rmail-old-text nil t rmail-summary-vector buffer-read-only /= 10 "
" set-marker set-buffer-modified-p buffer-modified-p rmail-mode-1 string= buffer-substring rmail-set-attribute "edited" boundp rmail-widen-to-current-msgbeg (lambda nil (byte-code "!!`!`\")" [buffer-read-only nil forward-line 2 looking-at "Summary-line: " delete-region 1] 6)) rmail-show-message] 13))

(defun rmail-abort-edit nil "\
Abort edit of current message; restore original contents." (interactive) (byte-code "ed\"c " [rmail-old-text nil delete-region rmail-cease-edit] 3))