+2000-10-13 Yoshiki Hayashi <yoshiki@xemacs.org>
+
+ * mime-edit.el (mime-edit-force-text-tag): New macro.
+ * mime-edit.el (mime-edit-insert-text-file):
+ * mime-edit.el (mime-edit-insert-external):
+ * mime-edit.el (mime-edit-insert-binary-string):
+ * mime-edit.el (mime-edit-insert-binary-file):
+ * mime-edit.el (mime-edit-process-multipart-1):
+ * mime-edit.el (mime-edit-normalize-body):
+ * mime-edit.el (mime-edit-enclose-region-internal):
+ * mime-edit.el (mime-edit-insert-key): Use mime-edit-force-text-tag.
+
+2000-10-12 Yoshiki Hayashi <yoshiki@xemacs.org>
+
+ * mime-edit.el (mime-edit-insert-insert-binary-string): Don't
+ make a blank only part.
+ (mime-edit-insert-binary-file): Ditto.
+ (mime-edit-insert-text-file): Ditto.
+
2000-10-10 Yoshiki Hayashi <yoshiki@xemacs.org>
* mime-edit.el (mime-edit-insert-place): Barf if on invisible region.
(goto-char (point-max)))
,@ body))
+(defmacro mime-edit-force-text-tag (regexp)
+ `(cond ((looking-at (concat "\n*\\(" ,regexp "\\)"))
+ (replace-match "\\1"))
+ ((not (eobp))
+ (insert (mime-make-text-tag) "\n"))))
+
;;; @ functions
;;;
(save-excursion
(let ((ret (insert-file-contents file)))
(forward-char (cadr ret))
- (if (and (not (eobp))
- (not (looking-at mime-edit-single-part-tag-regexp)))
- (insert (mime-make-text-tag) "\n")))))))
+ (mime-edit-force-text-tag mime-edit-single-part-regexp))))))
(defun mime-edit-insert-file (file &optional verbose)
"Insert a message from a FILE.
subtype
(insert "Content-Type: "
pritype "/" subtype (or parameters "") "\n"))
- (if (and (not (eobp))
- (not (looking-at mime-edit-single-part-tag-regexp)))
- (insert (mime-make-text-tag) "\n")))))
+ (mime-edit-force-text-tag mime-edit-single-part-tag-regexp))))
(defun mime-edit-insert-voice ()
"Insert a voice message."
(invisible-region (point-min) (point-max))
(goto-char (point-max)))
(goto-char (point-max))))
- (unless (or (looking-at mime-edit-tag-regexp)
- (= (point)(point-max)))
- (insert "\n")
- (mime-edit-insert-tag "text" "plain"))
+ (mime-edit-force-text-tag mime-edit-tag-regexp)
;; Define encoding even if it is 7bit.
(if (stringp encoding)
(save-excursion
(invisible-region (point-min) (point-max))
(goto-char (point-max)))
(goto-char (point-max))))
- (unless (or (looking-at mime-edit-tag-regexp)
- (= (point)(point-max)))
- (insert "\n")
- (mime-edit-insert-tag "text" "plain"))
+ (mime-edit-force-text-tag mime-edit-tag-regexp)
;; Define encoding even if it is 7bit.
(if (stringp encoding)
(save-excursion
(let ((beg (match-beginning 0))
(end (match-end 0)))
(delete-region beg end)
- (or (looking-at mime-edit-beginning-tag-regexp)
- (eobp)
- (insert (concat (mime-make-text-tag) "\n")))))
+ (mime-edit-force-text-tag mime-edit-beginning-tag-regxp)))
(cond ((string-equal type "quote")
(mime-edit-enquote-region bb eb))
((string-equal type "pgp-signed")
(if (= end (point-max))
nil
(goto-char end)
- (or (looking-at mime-edit-beginning-tag-regexp)
- (eobp)
- (insert (mime-make-text-tag) "\n")))
+ (mime-edit-force-text-tag mime-edit-beginning-tag-regexp))
(visible-region beg end)
(goto-char beg))
(cond
(goto-char (point-max))
(insert (format "--}-<<%s>>\n" type))
(goto-char (point-max)))
- (or (looking-at mime-edit-beginning-tag-regexp)
- (eobp)
- (insert (mime-make-text-tag) "\n"))))
+ (mime-edit-force-text-tag mime-edit-beginning-tag-regexp)))
(defun mime-edit-enclose-quote-region (beg end)
(interactive "*r")
(mime-edit-insert-tag "application" "pgp-keys")
(mime-edit-define-encoding "7bit")
(pgg-insert-key)
- (if (and (not (eobp))
- (not (looking-at mime-edit-single-part-tag-regexp)))
- (insert (mime-make-text-tag) "\n")))
+ (mime-edit-force-text-tag mime-edit-single-part-tag-regexp))
;;; @ flag setting