Header was modified.
[elisp/semi.git] / mime-edit.el
index 90effb5..15c1509 100644 (file)
@@ -7,7 +7,7 @@
 ;; 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.47 $
+;; Version: $Revision: 0.54 $
 ;; Keywords: MIME, multimedia, multilingual, mail, news
 
 ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
 
 ;;; Code:
 
+(require 'emu)
 (require 'sendmail)
 (require 'mail-utils)
 (require 'mel)
 (require 'mime-view)
 (require 'eword-encode)
 (require 'signature)
+(require 'alist)
 
 
 ;;; @ version
 ;;;
 
 (defconst mime-edit-RCS-ID
-  "$Id: mime-edit.el,v 0.47 1997-02-25 06:25:40 tmorioka Exp $")
+  "$Id: mime-edit.el,v 0.54 1997-03-03 17:31:19 morioka Exp $")
 
 (defconst mime-edit-version (get-version-string mime-edit-RCS-ID))
 
@@ -389,7 +391,7 @@ If encoding is nil, it is determined from its contents.")
   "*A string formatted version of mime/defaul-transfer-level")
 (make-variable-buffer-local 'mime-transfer-level-string)
 
-(defun mime-edit-make-charset-default-encoding-alist (transfer-level)
+(defun mime-make-charset-default-encoding-alist (transfer-level)
   (mapcar (function
           (lambda (charset-type)
             (let ((charset  (car charset-type))
@@ -403,7 +405,7 @@ If encoding is nil, it is determined from its contents.")
          mime-charset-type-list))
 
 (defvar mime-edit-charset-default-encoding-alist
-  (mime-edit-make-charset-default-encoding-alist mime-transfer-level))
+  (mime-make-charset-default-encoding-alist mime-transfer-level))
 (make-variable-buffer-local 'mime-edit-charset-default-encoding-alist)
 
 ;;; @@ about message inserting
@@ -521,6 +523,7 @@ Tspecials means any character that matches with it in header must be quoted.")
 (defconst mime-edit-mime-map (make-sparse-keymap)
   "Keymap for MIME commands.")
 
+
 ;;; @ keymap and menu
 ;;;
 
@@ -1720,14 +1723,25 @@ Content-Transfer-Encoding: 7bit
          ))
       )))
 
+(defsubst replace-space-with-underline (str)
+  (mapconcat (function
+             (lambda (arg)
+               (char-to-string
+                (if (eq arg ?\ )
+                    ?_
+                  arg)))) str "")
+  )
+
+(defun mime-edit-make-boundary ()
+  (concat mime-multipart-boundary "_"
+         (replace-space-with-underline (current-time-string))
+         ))
+
 (defun mime-edit-translate-body ()
   "Encode the tagged MIME body in current buffer in MIME compliant message."
   (interactive)
   (save-excursion
-    (let ((boundary
-          (concat mime-multipart-boundary "_"
-                  (replace-space-with-underline (current-time-string))
-                  ))
+    (let ((boundary (mime-edit-make-boundary))
          (i 1)
          ret)
       (while (mime-edit-process-multipart-1
@@ -1799,11 +1813,9 @@ Content-Transfer-Encoding: 7bit
        t)))
 
 (defun mime-edit-translate-region (beg end &optional boundary multipart)
-  (if (null boundary)
-      (setq boundary
-           (concat mime-multipart-boundary "_"
-                   (replace-space-with-underline (current-time-string))))
-    )
+  (or boundary
+      (setq boundary (mime-edit-make-boundary))
+      )
   (save-excursion
     (save-restriction
       (narrow-to-region beg end)
@@ -2120,8 +2132,7 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8."
       (setq mime-transfer-level 7)
       ))
   (setq mime-edit-charset-default-encoding-alist
-       (mime-edit-make-charset-default-encoding-alist
-        mime-transfer-level))
+       (mime-make-charset-default-encoding-alist mime-transfer-level))
   (message (format "Current transfer-level is %d bit"
                   mime-transfer-level))
   (setq mime-transfer-level-string