summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2011-11-22 23:41:17 -0800
committerGlenn Morris <rgm@gnu.org>2011-11-22 23:41:17 -0800
commit8038d2d2900195ee31941abe6d3b5df2ed7f75d9 (patch)
tree5516bdab9e8cfd8371c21edcf634527fffcff8db /lisp
parentf3fe222a8217cdf3a755b0541d1101634939bca6 (diff)
downloademacs-8038d2d2900195ee31941abe6d3b5df2ed7f75d9.tar.gz
Rmail trivia: give explicit errors for empty folders.
* 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
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/mail/rmail.el2
-rw-r--r--lisp/mail/rmailkwd.el3
-rw-r--r--lisp/mail/rmailout.el6
4 files changed, 15 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 54813759298..2a154b65890 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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)
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 6e79c5c82b1..b920c065de5 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -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)
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el
index 73542578bf6..472740aefd8 100644
--- a/lisp/mail/rmailkwd.el
+++ b/lisp/mail/rmailkwd.el
@@ -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)
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index c168ca9d8f5..ad76a493483 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -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")