(mime-editor/translate-region): fixed for a part starting without line
authormorioka <morioka>
Fri, 24 May 1996 14:56:34 +0000 (14:56 +0000)
committermorioka <morioka>
Fri, 24 May 1996 14:56:34 +0000 (14:56 +0000)
break.

mime-edit.el

index 79027c6..457bc55 100644 (file)
@@ -9,7 +9,7 @@
 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;;; Created: 1994/08/21 (renamed from mime.el;
 ;;;                      1996/05/24 renamed from tm-edit.el)
-;;; Version: $Revision: 0.1 $
+;;; Version: $Revision: 0.2 $
 ;;; Keywords: mail, news, MIME, multimedia, multilingual
 ;;;
 ;;; This file is part of SEMI (September, Emacs MIME Interface)
 ;;;
 
 (defconst mime-editor/RCS-ID
-  "$Id: mime-edit.el,v 0.1 1996-05-24 13:00:01 morioka Exp $")
+  "$Id: mime-edit.el,v 0.2 1996-05-24 14:56:34 morioka Exp $")
 
 (defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
 
@@ -1898,46 +1898,61 @@ Content-Transfer-Encoding: 7bit
        (while (re-search-forward mime-editor/single-part-tag-regexp nil t)
          (setq nparts (1+ nparts)))
        ;; Begin translation.
-       (cond ((and (<= nparts 1)(not multipart))
-              ;; It's a singular message.
-              (goto-char (point-min))
-              (while (re-search-forward
-                      mime-editor/single-part-tag-regexp nil t)
-                (setq tag
-                      (buffer-substring (match-beginning 0) (match-end 0)))
-                (delete-region (match-beginning 0) (1+ (match-end 0)))
-                (setq contype (mime-editor/get-contype tag))
-                (setq encoding (mime-editor/get-encoding tag))
-                ))
-             (t
-              ;; It's a multipart message.
-              (goto-char (point-min))
-              (while (re-search-forward
-                      mime-editor/single-part-tag-regexp nil t)
-                (setq tag
-                      (buffer-substring (match-beginning 0) (match-end 0)))
-                (delete-region (match-beginning 0) (match-end 0))
-                (setq contype (mime-editor/get-contype tag))
-                (setq encoding (mime-editor/get-encoding tag))
-                (insert "--" boundary "\n")
-                (insert "Content-Type: " contype "\n")
-                (if encoding
-                    (insert "Content-Transfer-Encoding: " encoding "\n"))
-                )
-              ;; Define Content-Type as "multipart/mixed".
-              (setq contype
-                    (concat "multipart/mixed;\n boundary=\"" boundary "\""))
-              ;; Content-Transfer-Encoding must be "7bit".
-              ;; The following encoding can be `nil', but is
-              ;; specified as is since there is no way that a user
-              ;; specifies it.
-              (setq encoding "7bit")
-              ;; Insert the trailer.
-              (goto-char (point-max))
-              (if multipart
-                  (insert "--" boundary "--\n")
-                (insert "\n--" boundary "--\n")
-                )))
+       (cond
+        ((and (<= nparts 1)(not multipart))
+         ;; It's a singular message.
+         (goto-char (point-min))
+         (while (re-search-forward
+                 mime-editor/single-part-tag-regexp nil t)
+           (setq tag
+                 (buffer-substring (match-beginning 0) (match-end 0)))
+           (delete-region (match-beginning 0) (1+ (match-end 0)))
+           (setq contype (mime-editor/get-contype tag))
+           (setq encoding (mime-editor/get-encoding tag))
+           ))
+        (t
+         ;; It's a multipart message.
+         (goto-char (point-min))
+         (if (re-search-forward
+              mime-editor/single-part-tag-regexp nil t)
+             (progn
+               (setq tag
+                     (buffer-substring
+                      (match-beginning 0) (match-end 0)))
+               (delete-region (match-beginning 0) (match-end 0))
+               (setq contype (mime-editor/get-contype tag))
+               (setq encoding (mime-editor/get-encoding tag))
+               (insert "--" boundary "\n")
+               (insert "Content-Type: " contype "\n")
+               (if encoding
+                   (insert "Content-Transfer-Encoding: " encoding "\n"))
+               
+               (while (re-search-forward
+                       mime-editor/single-part-tag-regexp nil t)
+                 (setq tag
+                       (buffer-substring (match-beginning 0) (match-end 0)))
+                 (delete-region (match-beginning 0) (match-end 0))
+                 (setq contype (mime-editor/get-contype tag))
+                 (setq encoding (mime-editor/get-encoding tag))
+                 (insert "\n--" boundary "\n")
+                 (insert "Content-Type: " contype "\n")
+                 (if encoding
+                     (insert "Content-Transfer-Encoding: " encoding "\n"))
+                 )))
+         ;; Define Content-Type as "multipart/mixed".
+         (setq contype
+               (concat "multipart/mixed;\n boundary=\"" boundary "\""))
+         ;; Content-Transfer-Encoding must be "7bit".
+         ;; The following encoding can be `nil', but is
+         ;; specified as is since there is no way that a user
+         ;; specifies it.
+         (setq encoding "7bit")
+         ;; Insert the trailer.
+         (goto-char (point-max))
+         (if multipart
+             (insert "--" boundary "--\n")
+           (insert "\n--" boundary "--\n")
+           )))
        (list contype encoding boundary nparts)
        ))))