Commit 8038d2d2 authored by Glenn Morris's avatar Glenn Morris
Browse files

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
parent f3fe222a
2011-11-23 Glenn Morris <rgm@gnu.org> 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-current-message): Doc fix.
* mail/rmail.el (rmail-message-filter): Mark as obsolete. (Bug#2624) * mail/rmail.el (rmail-message-filter): Mark as obsolete. (Bug#2624)
......
...@@ -3786,6 +3786,8 @@ which is an element of rmail-msgref-vector." ...@@ -3786,6 +3786,8 @@ which is an element of rmail-msgref-vector."
With prefix argument, \"resend\" the message instead of forwarding it; With prefix argument, \"resend\" the message instead of forwarding it;
see the documentation of `rmail-resend'." see the documentation of `rmail-resend'."
(interactive "P") (interactive "P")
(if (zerop rmail-current-message)
(error "No message to forward"))
(if resend (if resend
(call-interactively 'rmail-resend) (call-interactively 'rmail-resend)
(let ((forward-buffer rmail-buffer) (let ((forward-buffer rmail-buffer)
......
...@@ -96,7 +96,8 @@ LABEL may be a symbol or string." ...@@ -96,7 +96,8 @@ LABEL may be a symbol or string."
(error "More than one label specified")) (error "More than one label specified"))
(with-current-buffer rmail-buffer (with-current-buffer rmail-buffer
(rmail-maybe-set-message-counters) (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. ;; Force recalculation of summary for this message.
(aset rmail-summary-vector (1- msg) nil) (aset rmail-summary-vector (1- msg) nil)
(let (attr-index) (let (attr-index)
......
...@@ -468,6 +468,8 @@ from a non-Rmail buffer. In this case, COUNT is ignored." ...@@ -468,6 +468,8 @@ from a non-Rmail buffer. In this case, COUNT is ignored."
(if rmail-buffer (if rmail-buffer
(set-buffer rmail-buffer) (set-buffer rmail-buffer)
(error "There is no Rmail buffer")) (error "There is no Rmail buffer"))
(if (zerop rmail-total-messages)
(error "No messages to output"))
(let ((orig-count count) (let ((orig-count count)
beg end) beg end)
(while (> count 0) (while (> count 0)
...@@ -533,6 +535,8 @@ so you should call `rmail-output' directly in that case." ...@@ -533,6 +535,8 @@ so you should call `rmail-output' directly in that case."
(if rmail-buffer (if rmail-buffer
(set-buffer rmail-buffer) (set-buffer rmail-buffer)
(error "There is no Rmail buffer")) (error "There is no Rmail buffer"))
(if (zerop rmail-total-messages)
(error "No messages to output"))
(let ((orig-count count) (let ((orig-count count)
(cur (current-buffer))) (cur (current-buffer)))
(while (> count 0) (while (> count 0)
...@@ -594,6 +598,8 @@ than appending to it. Deletes the message after writing if ...@@ -594,6 +598,8 @@ than appending to it. Deletes the message after writing if
(expand-file-name file-name (expand-file-name file-name
(and rmail-default-body-file (and rmail-default-body-file
(file-name-directory rmail-default-body-file)))) (file-name-directory rmail-default-body-file))))
(if (zerop rmail-current-message)
(error "No message to output"))
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(search-forward "\n\n") (search-forward "\n\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment