From: Glenn Morris Date: Tue, 15 Nov 2011 00:34:01 +0000 (-0500) Subject: rmailout fix for bug#9978. X-Git-Tag: emacs-pretest-24.0.92~184 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=447f30f64b9269fa71faaa2dedf6b1f3957516fe;p=emacs.git rmailout fix for bug#9978. * lisp/mail/rmailout.el (rmail-output-to-rmail-buffer): Handle empty buffers. --- 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.