summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/gnus/mm-decode.el2
-rw-r--r--lisp/gnus/mm-view.el10
-rw-r--r--lisp/gnus/mml.el6
3 files changed, 11 insertions, 7 deletions
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 80a2e50c498..2a769fccf54 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -763,7 +763,7 @@ MIME-Version header before proceeding."
(mb enable-multibyte-characters)
beg)
(goto-char (point-min))
- (search-forward-regexp "^\n" nil t)
+ (search-forward-regexp "^\n" nil 'move) ;; There might be no body.
(setq beg (point))
(with-current-buffer
(generate-new-buffer " *mm*")
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index cf41c4595cb..b0d88d89843 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -370,10 +370,12 @@
(enriched-decode (point-min) (point-max))))
(mm-handle-set-undisplayer
handle
- `(lambda ()
- (let ((inhibit-read-only t))
- (delete-region ,(copy-marker (point-min) t)
- ,(point-max-marker))))))))
+ (if (= (point-min) (point-max))
+ #'ignore
+ `(lambda ()
+ (let ((inhibit-read-only t))
+ (delete-region ,(copy-marker (point-min) t)
+ ,(point-max-marker)))))))))
(defun mm-insert-inline (handle text)
"Insert TEXT inline from HANDLE."
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index cf79ca1ded6..be626858358 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -982,8 +982,10 @@ If HANDLES is non-nil, use it instead reparsing the buffer."
(unless handles
(setq handles (mm-dissect-buffer t)))
(goto-char (point-min))
- (search-forward "\n\n" nil t)
- (delete-region (point) (point-max))
+ (if (search-forward "\n\n" nil 'move)
+ (delete-region (point) (point-max))
+ ;; No content in the part that is the sole part of this message.
+ (insert (if (bolp) "\n" "\n\n")))
(if (stringp (car handles))
(mml-insert-mime handles)
(mml-insert-mime handles t))