;;; modified by YAMAOKA Katsumi <yamaoka@ga.sony.co.jp>
;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;;; Created: 1993/11/21 (obsolete mh-e-mime.el)
-;;; Version: $Revision: 7.49 $
+;;; Version: $Revision: 7.50 $
;;; Keywords: mail, MH, MIME, multimedia, encoded-word, multilingual
;;;
;;; This file is part of tm (Tools for MIME).
;;;
(defconst tm-mh-e/RCS-ID
- "$Id: tm-mh-e.el,v 7.49 1996/02/22 17:56:49 morioka Exp $")
+ "$Id: tm-mh-e.el,v 7.50 1996/02/26 08:41:56 morioka Exp $")
(defconst tm-mh-e/version (get-version-string tm-mh-e/RCS-ID))
(error "There is no current message"))))
(mh-yank-cur-msg)))
+(defun tm-mh-e/edit-again (msg)
+ (require 'mh-comp)
+ (interactive (list (mh-get-msg-num t)))
+ (let* ((from-folder mh-current-folder)
+ (config (current-window-configuration))
+ (draft
+ (cond ((and mh-draft-folder (equal from-folder mh-draft-folder))
+ (pop-to-buffer (find-file-noselect (mh-msg-filename msg)) t)
+ (if mime::preview/article-buffer
+ (switch-to-buffer mime::preview/article-buffer)
+ )
+ (rename-buffer (format "draft-%d" msg))
+ (buffer-name))
+ (t
+ (let ((file-coding-system-for-read *noconv*))
+ (mh-read-draft "clean-up" (mh-msg-filename msg) nil)
+ ))
+ )))
+ (setq buffer-read-only nil)
+ (goto-char (point-min))
+ (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)
+ (if (re-search-forward "^-+$" nil t)
+ (replace-match "")
+ )
+ (mime/edit-again t t)
+ (goto-char (point-min))
+ (set-buffer-modified-p nil)
+ (mh-compose-and-send-mail draft "" from-folder nil nil nil nil nil nil
+ config)))
+
(call-after-loaded
'mime-setup
(function
(substitute-key-definition
'mh-yank-cur-msg 'tm-mh-e/yank-cur-msg mh-letter-mode-map)
)))
+ (substitute-key-definition
+ 'mh-edit-again 'tm-mh-e/edit-again mh-folder-mode-map)
)))
;;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;;; Created: 1994/08/21 renamed from mime.el
-;;; Version: $Revision: 7.44 $
+;;; Version: $Revision: 7.45 $
;;; Keywords: mail, news, MIME, multimedia, multilingual
;;;
;;; This file is part of tm (Tools for MIME).
;;;
(defconst mime-editor/RCS-ID
- "$Id: tm-edit.el,v 7.44 1996/02/23 16:16:30 morioka Exp $")
+ "$Id: tm-edit.el,v 7.45 1996/02/26 08:43:36 morioka Exp $")
(defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
)
+;;; @ edit again
+;;;
+
+(defun mime-editor::edit-again ()
+ (save-excursion
+ (goto-char (point-min))
+ (let ((ctl (mime/Content-Type)))
+ (if ctl
+ (let ((ctype (car ctl))
+ (params (cdr ctl))
+ type stype)
+ (if (string-match "/" ctype)
+ (progn
+ (setq type (substring ctype 0 (match-beginning 0)))
+ (setq stype (substring ctype (match-end 0)))
+ )
+ (setq type ctype)
+ )
+ (cond ((string-equal type "multipart")
+ (let ((boundary (assoc-value "boundary" params)))
+ (re-search-forward (concat "--" boundary) nil t)
+ (let ((bb (match-beginning 0))
+ eb ee)
+ (re-search-forward (concat "\n--" boundary "--") nil t)
+ (setq eb (match-beginning 0))
+ (setq ee (match-end 0))
+ (delete-region eb ee)
+ (save-restriction
+ (narrow-to-region bb eb)
+ (goto-char (point-min))
+ (while (re-search-forward
+ (concat "\\(\n\\|^\\)--" boundary "\n") nil t)
+ (let ((beg (match-beginning 0))
+ end)
+ (delete-region beg (match-end 0))
+ (save-excursion
+ (if (re-search-forward
+ (concat "\n--" boundary) nil t)
+ (setq end (match-beginning 0))
+ (setq end (point-max))
+ )
+ (save-restriction
+ (narrow-to-region beg end)
+ (mime-editor::edit-again)
+ (goto-char (point-max))
+ (insert "\n")
+ ))))
+ (goto-char (point-min))
+ (insert (format "--<<%s>>-{\n" stype))
+ (goto-char (point-max))
+ (insert (format "\n--}-<<%s>>" stype))
+ ))
+ (goto-char (point-min))
+ (or (= (point-min) 1)
+ (delete-region (point-min)
+ (if (re-search-forward "^$" nil t)
+ (match-end 0)
+ (point-min)
+ )))
+ ))
+ (t
+ (let* ((str (rfc822/get-header-string-except
+ "^Content-Type" ""))
+ charset
+ (pstr
+ (mapconcat (function
+ (lambda (attr)
+ (if (string-equal (car attr)
+ "charset")
+ (progn
+ (setq charset (cdr attr))
+ "")
+ (concat ";" (car attr)
+ "=" (cdr attr))
+ )
+ ))
+ params ""))
+ )
+ (if charset
+ (mime/code-convert-region-to-emacs (point-min)
+ (point-max)
+ charset)
+ )
+ (and str
+ (setq pstr (concat pstr "\n" str))
+ )
+ (or (= (point-min) 1)
+ (delete-region (point-min)
+ (if (re-search-forward "^$" nil t)
+ (match-end 0)
+ (point-min)
+ )))
+ (insert (mime-create-tag
+ (concat type "/" stype pstr)))
+ ))))))))
+
+(defun mime/edit-again (&optional no-separator no-mode)
+ (interactive)
+ (mime-editor::edit-again)
+ (goto-char (point-min))
+ (save-restriction
+ (narrow-to-region (point-min)
+ (if (re-search-forward "^$" nil t)
+ (match-end 0)
+ (point-max)
+ ))
+ (goto-char (point-min))
+ (while (re-search-forward
+ "^\\(Content-.*\\|Mime-Version\\):" nil t)
+ (delete-region (match-beginning 0) (1+ (rfc822/field-end)))
+ ))
+ (or no-separator
+ (and (re-search-forward "^$")
+ (replace-match mail-header-separator)
+ ))
+ (or no-mode
+ (mime/editor-mode)
+ ))
+
+
;;; @ etc
;;;