From 50718fc219ea1759e1315efbd693c03a4ea019c7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 22 Jun 2011 19:39:29 -0400 Subject: [PATCH] Make mail exit more nicely when Rmail is in use. --- lisp/ChangeLog | 3 +++ lisp/mail/sendmail.el | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 049c3d2e0e0..89b33dc7a62 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-06-22 Richard Stallman + * mail/sendmail.el (mail-bury): If Rmail is in use, return nicely + to Rmail even if not started by a special Rmail command. + * mail/rmailmm.el (rmail-insert-mime-forwarded-message): Copy the buffer currently showing just one message. diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index f4ef9b91903..c1405ec5ff3 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -806,10 +806,18 @@ Prefix arg means don't delete this window." (defun mail-bury (&optional arg) "Bury this mail buffer." - (let ((newbuf (other-buffer (current-buffer)))) + (let ((newbuf (other-buffer (current-buffer))) + (return-action mail-return-action) + some-rmail) (bury-buffer (current-buffer)) - (if (and (null arg) mail-return-action) - (apply (car mail-return-action) (cdr mail-return-action)) + ;; If there is an Rmail buffer, return to it nicely + ;; 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 (null arg) return-action) + (apply (car return-action) (cdr return-action)) (switch-to-buffer newbuf)))) (defcustom mail-send-hook nil -- 2.39.2