+2011-06-27 Richard Stallman <rms@gnu.org>
+
+ * mail/rmailmm.el (rmail-mime-process-multipart):
+ Handle truncated messages.
+
2011-06-27 Glenn Morris <rgm@gnu.org>
* progmodes/flymake.el (flymake-err-line-patterns):
;; the beginning of the next part. The current point is just
;; after the boundary tag.
(setq beg (point-min))
- (while (search-forward boundary nil t)
- (setq end (match-beginning 0))
+
+ (while (or (and (search-forward boundary nil t)
+ (setq end (match-beginning 0)))
+ ;; If the boundary does not appear at all,
+ ;; the message was truncated.
+ ;; Handle the rest of the truncated message
+ ;; (if it isn't empty) by pretending that the boundary
+ ;; appears at the end of the message.
+ (and (save-excursion
+ (skip-chars-forward "\n")
+ (> (point-max) (point)))
+ (setq end (point-max))))
;; If this is the last boundary according to RFC 2046, hide the
;; epilogue, else hide the boundary only. Use a marker for
;; `next' because `rmail-mime-show' may change the buffer.
(setq next (point-max-marker)))
((looking-at "[ \t]*\n")
(setq next (copy-marker (match-end 0) t)))
+ ((= end (point-max))
+ ;; We're handling what's left of a truncated message.
+ (setq next (point-max-marker)))
(t
;; The original code signalled an error as below, but
;; this line may be a boundary of nested multipart. So,