;; 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.81 $
+;; Version: $Revision: 0.88 $
;; 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.81 1997-05-27 03:12:56 morioka Exp $")
+ "$Id: mime-edit.el,v 0.88 1997-09-05 07:10:59 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
(defvar mime-edit-voice-recorder
(function mime-edit-voice-recorder-for-sun)
- "*Function to record a voice message and encode it. [mime-edit.el]")
+ "*Function to record a voice message and encode it.")
(defvar mime-edit-mode-hook nil
"*Hook called when enter MIME mode.")
"Xref" "X-UIDL" "X-Filter" "X-Gnus-.*" "X-VM-.*")
"Delete these fields from original message when it is inserted
as message/rfc822 part.
-Each elements are regexp of field-name. [mime-edit.el]")
+Each elements are regexp of field-name.")
(defvar mime-edit-yank-ignored-field-regexp
(concat "^"
;;;
(defvar mime-edit-split-message t
- "*Split large message if it is non-nil. [mime-edit.el]")
+ "*Split large message if it is non-nil.")
(defvar mime-edit-message-default-max-lines 1000
- "*Default maximum lines of a message. [mime-edit.el]")
+ "*Default maximum lines of a message.")
(defvar mime-edit-message-max-lines-alist
'((news-reply-mode . 500))
"Alist of major-mode vs maximum lines of a message.
If it is not specified for a major-mode,
-`mime-edit-message-default-max-lines' is used. [mime-edit.el]")
+`mime-edit-message-default-max-lines' is used.")
(defconst mime-edit-split-ignored-field-regexp
"\\(^Content-\\|^Subject:\\|^Mime-Version:\\)")
;;;
(defvar mime-edit-signing-type 'pgp-elkins
- "*PGP signing type (pgp-elkins, pgp-kazu or nil). [mime-edit.el]")
+ "*PGP signing type (pgp-elkins, pgp-kazu or nil).")
(defvar mime-edit-encrypting-type 'pgp-elkins
- "*PGP encrypting type (pgp-elkins, pgp-kazu or nil). [mime-edit.el]")
+ "*PGP encrypting type (pgp-elkins, pgp-kazu or nil).")
;;; @@ about tag
))
(defun mime-prompt-for-encoding (default)
- "Ask for Content-Transfer-Encoding. [mime-edit.el]"
+ "Ask for Content-Transfer-Encoding."
(let (encoding)
(while (string=
(setq encoding
(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)
)
))))
)
(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)
))
(defun mime-edit-voice-recorder-for-sun (encoding)
"Record voice in a buffer using Sun audio device,
-and insert data encoded as ENCODING. [mime-edit.el]"
+and insert data encoded as ENCODING."
(message "Start the recording on %s. Type C-g to finish the recording..."
(system-name))
(mime-insert-encoded-file "/dev/audio" encoding)
(defvar mime-edit-buffer nil) ; buffer local variable
(defun mime-edit-preview-message ()
- "preview editing MIME message. [mime-edit.el]"
+ "preview editing MIME message."
(interactive)
(let* ((str (buffer-string))
(separator mail-header-separator)
(defun mime-edit-decode-buffer (not-decode-text)
(save-excursion
(goto-char (point-min))
- (let ((ctl (mime/Content-Type)))
+ (let ((ctl (mime-read-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)
- )
+ (let ((type (car ctl))
+ (stype (car (cdr ctl)))
+ (params (cdr (cdr ctl)))
+ )
(cond
- ((string= ctype "application/pgp-signature")
+ ((and (eq type 'application)(eq stype 'pgp-signature))
(delete-region (point-min)(point-max))
)
- ((string= type "multipart")
+ ((eq type 'multipart)
(let* ((boundary (cdr (assoc "boundary" params)))
(boundary-pat
(concat "\n--" (regexp-quote boundary) "[ \t]*\n"))
)))
))
(t
- (let* (charset
+ (let* ((ctype (format "%s/%s" type stype))
+ charset
(pstr
(let ((bytes (+ 14 (length ctype))))
(mapconcat (function
(lambda (attr)
- (if (string-equal (car attr) "charset")
+ (if (string= (car attr) "charset")
(progn
(setq charset (cdr attr))
"")
(eliminate-top-spaces
(std11-unfold-string
(buffer-substring hbeg end))))
- (if (or charset (string-equal type "text"))
+ (if (or charset (eq type 'text))
(progn
(delete-region beg (1+ end))
(goto-char (point-min))
(insert
(concat "\n"
(mime-create-tag
- (concat type "/" stype pstr) encoding)))
+ (format "%s/%s%s" type stype pstr)
+ encoding)))
)
(delete-region (point-min) he)
(insert
(mime-create-tag
- (concat type "/" stype pstr) encoding))
+ (format "%s/%s%s" type stype pstr)
+ encoding))
))
))))
(or not-decode-text