diff options
| -rw-r--r-- | lisp/gnus/message.el | 5 | ||||
| -rw-r--r-- | lisp/gnus/mml.el | 19 |
2 files changed, 13 insertions, 11 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ef6455ac5c9..ef9f8429d40 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -8061,7 +8061,10 @@ regexp VARSTR." | |||
| 8061 | (message-goto-body) | 8061 | (message-goto-body) |
| 8062 | (save-restriction | 8062 | (save-restriction |
| 8063 | (narrow-to-region (point) (point-max)) | 8063 | (narrow-to-region (point) (point-max)) |
| 8064 | (let ((new (mml-generate-mime))) | 8064 | (let ((new (mml-generate-mime nil |
| 8065 | (save-restriction | ||
| 8066 | (message-narrow-to-headers) | ||
| 8067 | (mail-fetch-field "content-type"))))) | ||
| 8065 | (when new | 8068 | (when new |
| 8066 | (delete-region (point-min) (point-max)) | 8069 | (delete-region (point-min) (point-max)) |
| 8067 | (insert new) | 8070 | (insert new) |
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 4a0d40ac0ed..7fd78d7b9c1 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el | |||
| @@ -295,14 +295,6 @@ part. This is for the internal use, you should never modify the value.") | |||
| 295 | (t | 295 | (t |
| 296 | (mm-find-mime-charset-region point (point) | 296 | (mm-find-mime-charset-region point (point) |
| 297 | mm-hack-charsets)))) | 297 | mm-hack-charsets)))) |
| 298 | ;; If the user has inserted a Content-Type header, then | ||
| 299 | ;; respect that instead of overwriting with "text/plain". | ||
| 300 | (save-restriction | ||
| 301 | (narrow-to-region point (point)) | ||
| 302 | (let ((content-type (mail-fetch-field "content-type"))) | ||
| 303 | (when (and content-type | ||
| 304 | (eq (car tag) 'part)) | ||
| 305 | (setcdr (assq 'type tag) content-type)))) | ||
| 306 | (when (and (not raw) (memq nil charsets)) | 298 | (when (and (not raw) (memq nil charsets)) |
| 307 | (if (or (memq 'unknown-encoding mml-confirmation-set) | 299 | (if (or (memq 'unknown-encoding mml-confirmation-set) |
| 308 | (message-options-get 'unknown-encoding) | 300 | (message-options-get 'unknown-encoding) |
| @@ -479,10 +471,13 @@ If MML is non-nil, return the buffer up till the correspondent mml tag." | |||
| 479 | (declare-function libxml-parse-html-region "xml.c" | 471 | (declare-function libxml-parse-html-region "xml.c" |
| 480 | (start end &optional base-url discard-comments)) | 472 | (start end &optional base-url discard-comments)) |
| 481 | 473 | ||
| 482 | (defun mml-generate-mime (&optional multipart-type) | 474 | (defun mml-generate-mime (&optional multipart-type content-type) |
| 483 | "Generate a MIME message based on the current MML document. | 475 | "Generate a MIME message based on the current MML document. |
| 484 | MULTIPART-TYPE defaults to \"mixed\", but can also | 476 | MULTIPART-TYPE defaults to \"mixed\", but can also |
| 485 | be \"related\" or \"alternate\"." | 477 | be \"related\" or \"alternate\". |
| 478 | |||
| 479 | If CONTENT-TYPE (and there's only one part), override the content | ||
| 480 | type detected." | ||
| 486 | (let ((cont (mml-parse)) | 481 | (let ((cont (mml-parse)) |
| 487 | (mml-multipart-number mml-multipart-number) | 482 | (mml-multipart-number mml-multipart-number) |
| 488 | (options message-options)) | 483 | (options message-options)) |
| @@ -490,6 +485,10 @@ be \"related\" or \"alternate\"." | |||
| 490 | nil | 485 | nil |
| 491 | (when (and (consp (car cont)) | 486 | (when (and (consp (car cont)) |
| 492 | (= (length cont) 1) | 487 | (= (length cont) 1) |
| 488 | content-type) | ||
| 489 | (setcdr (assq 'type (cdr (car cont))) content-type)) | ||
| 490 | (when (and (consp (car cont)) | ||
| 491 | (= (length cont) 1) | ||
| 493 | (fboundp 'libxml-parse-html-region) | 492 | (fboundp 'libxml-parse-html-region) |
| 494 | (equal (cdr (assq 'type (car cont))) "text/html")) | 493 | (equal (cdr (assq 'type (car cont))) "text/html")) |
| 495 | (setq cont (mml-expand-html-into-multipart-related (car cont)))) | 494 | (setq cont (mml-expand-html-into-multipart-related (car cont)))) |