X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmml.el;h=cc1aedf1b978294ba1f03f5dc545a6faea328234;hb=873ba7b51ddfb07246cd874b7de72662308236c9;hp=352fa329e3e904c34aae41738085b23e374c7be3;hpb=ed12cb81782013074a4b5d0b3084a0d690369836;p=gnus diff --git a/lisp/mml.el b/lisp/mml.el index 352fa329e..cc1aedf1b 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -1,6 +1,6 @@ ;;; mml.el --- A package for parsing and validating MML documents -;; Copyright (C) 1998-2011 Free Software Foundation, Inc. +;; Copyright (C) 1998-2012 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; This file is part of GNU Emacs. @@ -463,19 +463,27 @@ If MML is non-nil, return the buffer up till the correspondent mml tag." (defvar mml-multipart-number 0) (defvar mml-inhibit-compute-boundary nil) -(defun mml-generate-mime () - "Generate a MIME message based on the current MML document." +(defun mml-generate-mime (&optional multipart-type) + "Generate a MIME message based on the current MML document. +MULTIPART-TYPE defaults to \"mixed\", but can also +be \"related\" or \"alternate\"." (let ((cont (mml-parse)) - (mml-multipart-number mml-multipart-number)) + (mml-multipart-number mml-multipart-number) + (options message-options)) (if (not cont) nil - (mm-with-multibyte-buffer - (if (and (consp (car cont)) - (= (length cont) 1)) - (mml-generate-mime-1 (car cont)) - (mml-generate-mime-1 (nconc (list 'multipart '(type . "mixed")) - cont))) - (buffer-string))))) + (prog1 + (mm-with-multibyte-buffer + (setq message-options options) + (if (and (consp (car cont)) + (= (length cont) 1)) + (mml-generate-mime-1 (car cont)) + (mml-generate-mime-1 + (nconc (list 'multipart (cons 'type (or multipart-type "mixed"))) + cont))) + (setq options message-options) + (buffer-string)) + (setq message-options options))))) (defun mml-generate-mime-1 (cont) (let ((mm-use-ultra-safe-encoding @@ -1454,7 +1462,7 @@ Should be adopted if code in `message-send-mail' is changed." "Display current buffer with Gnus, in a new buffer. If RAW, display a raw encoded MIME message. -The window layout for the preview buffer is controled by the variables +The window layout for the preview buffer is controlled by the variables `special-display-buffer-names', `special-display-regexps', or `gnus-buffer-configuration' (the first match made will be used), or the `pop-to-buffer' function."