summaryrefslogtreecommitdiff
path: root/lisp/mail/sendmail.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mail/sendmail.el')
-rw-r--r--lisp/mail/sendmail.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index f8958a691b2..0b0f2795610 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -863,8 +863,11 @@ Prefix arg means don't delete this window."
;; even if this message was not started by an Rmail command.
(unless return-action
(dolist (buffer (buffer-list))
- (if (eq (buffer-local-value 'major-mode buffer) 'rmail-mode)
- (setq return-action `(rmail-mail-return ,newbuf)))))
+ (if (and (eq (buffer-local-value 'major-mode buffer) 'rmail-mode)
+ (null return-action)
+ ;; Don't match message-viewer buffer.
+ (not (string-match "\\` " (buffer-name buffer))))
+ (setq return-action `(rmail-mail-return ,buffer)))))
(if (and (null arg) return-action)
(apply (car return-action) (cdr return-action))
(switch-to-buffer newbuf))))