;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1994/08/21 renamed from mime.el
;; Renamed: 1997/2/21 from tm-edit.el
-;; Version: $Revision: 0.76 $
+;; Version: $Revision: 0.85 $
;; Keywords: MIME, multimedia, multilingual, mail, news
;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
;;;
(defconst mime-edit-RCS-ID
- "$Id: mime-edit.el,v 0.76 1997-03-21 17:55:10 morioka Exp $")
+ "$Id: mime-edit.el,v 0.85 1997-07-05 17:18:02 morioka Exp $")
-(defconst mime-edit-version (get-version-string mime-edit-RCS-ID))
+(defconst mime-edit-version `,(get-version-string mime-edit-RCS-ID))
(defconst mime-edit-version-name
- (concat "SEMI MIME-Edit " mime-edit-version))
+ `,(concat "SEMI MIME-Edit " mime-edit-version
+ " \"" semi-version-name "\""))
;;; @ variables
("html"
;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
)
- ("x-rot13-47")
+ ("x-rot13-47-48")
)
("message"
("external-body"
("image"
("gif")
("jpeg")
+ ("png")
("tiff")
("x-pic")
("x-mag")
"base64"
"inline" (("filename" . file))
)
+ ("\\.png$"
+ "image" "png" nil
+ "base64"
+ "inline" (("filename" . file))
+ )
("\\.tiff$"
"image" "tiff" nil
"base64"
(defun mime-edit-content-end ()
"Return the point of the end of content."
(save-excursion
- (let ((beg (point)))
- (if (mime-edit-goto-tag)
- (progn
- (goto-char (match-end 0))
- (if (invisible-p (point))
- (next-visible-point (point))
- ;; Move to the end of this text.
- (if (re-search-forward mime-edit-tag-regexp nil 'move)
- ;; Don't forget a multiline tag.
- (goto-char (match-beginning 0))
- )
- (point)
- ))
- ;; Assume the message begins with text/plain.
- (goto-char (mime-edit-content-beginning))
- (if (re-search-forward mime-edit-tag-regexp nil 'move)
- ;; Don't forget a multiline tag.
- (goto-char (match-beginning 0)))
- (point))
- )))
+ (if (mime-edit-goto-tag)
+ (progn
+ (goto-char (match-end 0))
+ (if (invisible-p (point))
+ (next-visible-point (point))
+ ;; Move to the end of this text.
+ (if (re-search-forward mime-edit-tag-regexp nil 'move)
+ ;; Don't forget a multiline tag.
+ (goto-char (match-beginning 0))
+ )
+ (point)
+ ))
+ ;; Assume the message begins with text/plain.
+ (goto-char (mime-edit-content-beginning))
+ (if (re-search-forward mime-edit-tag-regexp nil 'move)
+ ;; Don't forget a multiline tag.
+ (goto-char (match-beginning 0)))
+ (point))
+ ))
(defun mime-edit-define-charset (charset)
"Set charset of current tag to CHARSET."
(insert (format "Content-Transfer-Encoding: %s\n" encoding))
)
(insert "\n")
- (or (funcall (pgp-function 'mime-sign)
- (point-min)(point-max) nil nil pgp-boundary)
+ (or (as-binary-process
+ (funcall (pgp-function 'mime-sign)
+ (point-min)(point-max) nil nil pgp-boundary))
(throw 'mime-edit-error 'pgp-error)
)
))))
(intern (downcase charset))
(mime-edit-choose-charset)))
(mime-edit-define-charset charset)
- (cond ((string-equal contype "text/x-rot13-47")
+ (cond ((string-equal contype "text/x-rot13-47-48")
(save-excursion
(forward-line)
- (set-mark (point))
- (goto-char (mime-edit-content-end))
- (tm:caesar-region)
+ (mule-caesar-region (point) (mime-edit-content-end))
))
((string-equal contype "text/enriched")
(save-excursion
)
(encode-mime-charset-region beg (mime-edit-content-end)
charset)
+ ;; Protect "From " in beginning of line
+ (save-restriction
+ (narrow-to-region beg (mime-edit-content-end))
+ (goto-char beg)
+ (if (re-search-forward "^From " nil t)
+ (unless encoding
+ (if (memq charset '(iso-2022-jp
+ iso-2022-jp-2
+ iso-2022-int-1
+ x-ctext))
+ (while (progn
+ (replace-match "\e(BFrom ")
+ (re-search-forward "^From " nil t)
+ ))
+ (setq encoding "quoted-printable")
+ ))))
+ ;; canonicalize line break code
+ (or (member encoding '(nil "7bit" "8bit" "quoted-printable"))
+ (save-restriction
+ (narrow-to-region beg (mime-edit-content-end))
+ (goto-char beg)
+ (while (re-search-forward "\\([^\r]\\)\n" nil t)
+ (replace-match
+ (concat (buffer-substring (match-beginning 0)
+ (match-end 1)) "\r\n"))
+ )))
+ (goto-char beg)
(mime-encode-region beg (mime-edit-content-end) encoding)
(mime-edit-define-encoding encoding)
))