changeset 77819:20662529a1ae

(message-pop-to-buffer): Add switch-function argument. (message-mail): Pass switch-function argument to it.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 28 May 2007 02:44:17 +0000
parents 84e8b9cca621
children 7eaceb1da0a6
files lisp/gnus/message.el
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/message.el	Mon May 28 02:43:14 2007 +0000
+++ b/lisp/gnus/message.el	Mon May 28 02:44:17 2007 +0000
@@ -5578,7 +5578,7 @@
 	     'car-less-than-car)))
 	  new)))))
 
-(defun message-pop-to-buffer (name)
+(defun message-pop-to-buffer (name &optional switch-function)
   "Pop to buffer NAME, and warn if it already exists and is modified."
   (let ((buffer (get-buffer name)))
     (if (and buffer
@@ -5589,14 +5589,16 @@
 	      (progn
 		(gnus-select-frame-set-input-focus (window-frame window))
 		(select-window window))
-	    (set-buffer (pop-to-buffer buffer)))
+	    (funcall (or switch-function 'pop-to-buffer) buffer)
+	    (set-buffer buffer))
 	  (when (and (buffer-modified-p)
 		     (not (prog1
 			      (y-or-n-p
 			       "Message already being composed; erase? ")
 			    (message nil))))
 	    (error "Message being composed")))
-      (set-buffer (pop-to-buffer name)))
+      (funcall (or switch-function 'pop-to-buffer) name)
+      (set-buffer name))
     (erase-buffer)
     (message-mode)))
 
@@ -5833,15 +5835,15 @@
   (interactive)
   (let ((message-this-is-mail t) replybuffer)
     (unless (message-mail-user-agent)
-      (funcall
-       (or switch-function 'message-pop-to-buffer)
+      (message-pop-to-buffer
        ;; Search for the existing message buffer if `continue' is non-nil.
        (let ((message-generate-new-buffers
 	      (when (or (not continue)
 			(eq message-generate-new-buffers 'standard)
 			(functionp message-generate-new-buffers))
 		message-generate-new-buffers)))
-	 (message-buffer-name "mail" to))))
+	 (message-buffer-name "mail" to))
+       switch-function))
     ;; FIXME: message-mail should do something if YANK-ACTION is not
     ;; insert-buffer.
     (and (consp yank-action) (eq (car yank-action) 'insert-buffer)