From 447f30f64b9269fa71faaa2dedf6b1f3957516fe Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 14 Nov 2011 19:34:01 -0500 Subject: [PATCH] rmailout fix for bug#9978. * lisp/mail/rmailout.el (rmail-output-to-rmail-buffer): Handle empty buffers. --- lisp/ChangeLog | 5 +++++ lisp/mail/rmailout.el | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 091117ef53d..a6d49015422 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-11-15 Glenn Morris + + * mail/rmailout.el (rmail-output-to-rmail-buffer): + Handle empty buffers. (Bug#9978) + 2011-11-14 Juanma Barranquero * international/mule.el (define-charset): diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index 3926b426a67..c168ca9d8f5 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el @@ -377,11 +377,12 @@ display message number MSG." (rmail-maybe-set-message-counters) ;; Insert the new message after the last old message. (widen) - ;; Make sure the last old message ends with a blank line. - (goto-char (point-max)) - (rmail-ensure-blank-line) - ;; Insert the new message at the end. - (narrow-to-region (point-max) (point-max)) + (unless (zerop (buffer-size)) + ;; Make sure the last old message ends with a blank line. + (goto-char (point-max)) + (rmail-ensure-blank-line) + ;; Insert the new message at the end. + (narrow-to-region (point-max) (point-max))) (insert-buffer-substring tembuf) (rmail-count-new-messages t) ;; FIXME should re-use existing windows. -- 2.39.2