From: morioka Date: Fri, 24 May 1996 14:56:34 +0000 (+0000) Subject: (mime-editor/translate-region): fixed for a part starting without line X-Git-Tag: Hokutetsu-Ishikawa-new~401 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa7b0a50db1ad9610396c1b5cd0b83b4b100a7ab;p=elisp%2Fsemi.git (mime-editor/translate-region): fixed for a part starting without line break. --- diff --git a/mime-edit.el b/mime-edit.el index 79027c6..457bc55 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -9,7 +9,7 @@ ;;; Maintainer: MORIOKA Tomohiko ;;; 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) @@ -123,7 +123,7 @@ ;;; (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) ))))