Subject: 23.3; Rmail save messages fails to complete after deleting all the messages in an inbox if a summary buffer exists [PATCH]

From: Mark Lillibridge <[email-masked]>
Date: Sun, 13 Nov 2011 11:40:52 -0800

This bug is easy to reproduce: create an Rmail inbox with a couple
of messages and show its summary via 'h'.  Now delete each of the
messages then hit 's'.  You will receive an error message "No messages
to summarize", the summary (if any) will fail to be updated (still shows
the deleted messages), the mode line for the Rmail buffer will show the
wrong number of messages, and the buffer is not actually saved!  You
have to hit 's' again to get it to actually save the buffer.

    This bug is a direct consequence of Bug #9964: 23.3; Rmail is no
longer able to display a summary buffer with no messages.  In
particular, rmail-new-summary[-1] throws an error if there are no
messages in the inbox and this prevents rmail-expunge-and-save from
completing its tasks.  The correct fix is to fix bug 9964 -- that is,
fix things so summary buffers with no messages work again.  In the
meantime, here's a workaround patch that just ignores errors from
rmail-summary.

- Mark

ts-rhel5 [122]% ( setenv LC_ALL C ; setenv TZ UTC0 ; diff -Naur original-rmail.el rmail2.el )
--- original-rmail.el   2011-02-23 23:23:08.000000000 +0000
+++ rmail2.el   2011-11-13 19:23:49.408122000 +0000
@@ -3425,8 +3425,11 @@
              (let ((total rmail-total-messages))
                (with-current-buffer rmail-summary-buffer
                  (let ((rmail-total-messages total))
-                   (rmail-update-summary))))
-           (rmail-select-summary (rmail-update-summary))))
+           ; ignore errors (twice) from rmail-update-summary as
+           ; workaround for bug #9964; FIXME: remove once that bug is
+           ; fixed:
+                   (ignore-errors (rmail-update-summary)))))
+           (rmail-select-summary (ignore-errors (rmail-update-summary)))))
       ;; We always show a message, because (rmail-only-expunge t)
       ;; leaves the rmail buffer unswapped.
       ;; If we expunged the current message, a new one is current now,