]> code.delx.au - gnu-emacs/commitdiff
Rmail trivia: give explicit errors for empty folders.
authorGlenn Morris <rgm@gnu.org>
Wed, 23 Nov 2011 07:41:17 +0000 (23:41 -0800)
committerGlenn Morris <rgm@gnu.org>
Wed, 23 Nov 2011 07:41:17 +0000 (23:41 -0800)
* mail/rmail.el (rmail-forward):
* mail/rmailkwd.el (rmail-set-label):
* mail/rmailout.el (rmail-output, rmail-output-as-seen)
(rmail-output-body-to-file): Give error if no message.

Fixes: debbugs:10082
lisp/ChangeLog
lisp/mail/rmail.el
lisp/mail/rmailkwd.el
lisp/mail/rmailout.el

index 54813759298f4a4705f3218dd41639798cd0f55e..2a154b6589009a8da65224e76bab4b8c2603bd93 100644 (file)
@@ -1,5 +1,10 @@
 2011-11-23  Glenn Morris  <rgm@gnu.org>
 
+       * mail/rmail.el (rmail-forward):
+       * mail/rmailkwd.el (rmail-set-label):
+       * mail/rmailout.el (rmail-output, rmail-output-as-seen)
+       (rmail-output-body-to-file): Give error if no message.  (Bug#10082)
+
        * mail/rmail.el (rmail-current-message): Doc fix.
 
        * mail/rmail.el (rmail-message-filter): Mark as obsolete.  (Bug#2624)
index 6e79c5c82b1a639492ddde5ecc8cb21d5be74ca8..b920c065de550f14f34f67f8729b200d25a70e34 100644 (file)
@@ -3786,6 +3786,8 @@ which is an element of rmail-msgref-vector."
 With prefix argument, \"resend\" the message instead of forwarding it;
 see the documentation of `rmail-resend'."
   (interactive "P")
+  (if (zerop rmail-current-message)
+      (error "No message to forward"))
   (if resend
       (call-interactively 'rmail-resend)
     (let ((forward-buffer rmail-buffer)
index 73542578bf6aee8997ff5125f8a30ab25ac65bb3..472740aefd8b6ee745425b6efb94db753cc078a3 100644 (file)
@@ -96,7 +96,8 @@ LABEL may be a symbol or string."
       (error "More than one label specified"))
   (with-current-buffer rmail-buffer
     (rmail-maybe-set-message-counters)
-    (or msg (setq msg rmail-current-message))
+    (if (zerop (or msg (setq msg rmail-current-message)))
+       (error "No message"))
     ;; Force recalculation of summary for this message.
     (aset rmail-summary-vector (1- msg) nil)
     (let (attr-index)
index c168ca9d8f51c2c3c3a6247a9994e7f4df419031..ad76a493483fe12bac1080272316a9d726605cdf 100644 (file)
@@ -468,6 +468,8 @@ from a non-Rmail buffer.  In this case, COUNT is ignored."
       (if rmail-buffer
          (set-buffer rmail-buffer)
        (error "There is no Rmail buffer"))
+      (if (zerop rmail-total-messages)
+         (error "No messages to output"))
       (let ((orig-count count)
            beg end)
        (while (> count 0)
@@ -533,6 +535,8 @@ so you should call `rmail-output' directly in that case."
     (if rmail-buffer
        (set-buffer rmail-buffer)
       (error "There is no Rmail buffer"))
+    (if (zerop rmail-total-messages)
+       (error "No messages to output"))
     (let ((orig-count count)
          (cur (current-buffer)))
       (while (> count 0)
@@ -594,6 +598,8 @@ than appending to it.  Deletes the message after writing if
        (expand-file-name file-name
                          (and rmail-default-body-file
                               (file-name-directory rmail-default-body-file))))
+  (if (zerop rmail-current-message)
+      (error "No message to output"))
   (save-excursion
     (goto-char (point-min))
     (search-forward "\n\n")