changeset 112261:0071290a6df9

* message.el (message-bury): Add special-case handling for Rmail. This should not be merged into the trunk.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 12 Jan 2011 23:24:31 -0500
parents b3d66f88eeae
children e4c00899294b
files lisp/gnus/ChangeLog lisp/gnus/message.el
diffstat 2 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Wed Jan 12 15:12:13 2011 +0900
+++ b/lisp/gnus/ChangeLog	Wed Jan 12 23:24:31 2011 -0500
@@ -1,3 +1,7 @@
+2011-01-13  Chong Yidong  <cyd@stupidchicken.com>
+
+	* message.el (message-bury): Add special-case handling for Rmail.
+
 2011-01-12  Glenn Morris  <rgm@gnu.org>
 
 	* message.el (message-mail): A compose-mail function should
--- a/lisp/gnus/message.el	Wed Jan 12 15:12:13 2011 +0900
+++ b/lisp/gnus/message.el	Wed Jan 12 23:24:31 2011 -0500
@@ -4023,12 +4023,32 @@
 
 (defun message-bury (buffer)
   "Bury this mail BUFFER."
-  (let ((newbuf (other-buffer buffer)))
-    (bury-buffer buffer)
-    (if (and (window-dedicated-p (selected-window))
+  (let ((newbuf (other-buffer (current-buffer))))
+    (bury-buffer (current-buffer))
+    (if (and (window-dedicated-p (frame-selected-window))
 	     (not (null (delq (selected-frame) (visible-frame-list)))))
 	(delete-frame (selected-frame))
-      (switch-to-buffer newbuf))))
+      ;; Temporary hack to make this behave like `mail-bury', when
+      ;; used with Rmail.  Replaced in Emacs 24 with
+      (let (rmail-flag summary-buffer)
+	(and (not (one-window-p))
+	     (with-current-buffer
+                 (window-buffer (next-window (selected-window) 'not))
+	       (setq rmail-flag (eq major-mode 'rmail-mode))
+	       (setq summary-buffer
+		     (and (if (boundp 'mail-bury-selects-summary)
+			      mail-bury-selects-summary
+			    t)
+			  (boundp 'rmail-summary-buffer)
+			  rmail-summary-buffer
+			  (buffer-name rmail-summary-buffer)
+			  (not (get-buffer-window rmail-summary-buffer))
+			  rmail-summary-buffer))))
+	(if rmail-flag
+	    ;; If the Rmail buffer has a summary, show that.
+	    (if summary-buffer (switch-to-buffer summary-buffer)
+	      (delete-window))
+	  (switch-to-buffer newbuf))))))
 
 (defun message-send (&optional arg)
   "Send the message in the current buffer.