[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /srv/bzr/emacs/trunk r106599: message.el (message-pop-to-buffer): Us

From: Katsumi Yamaoka
Subject: Re: /srv/bzr/emacs/trunk r106599: message.el (message-pop-to-buffer): Use pop-to-buffer-same-window for last change.
Date: Wed, 07 Dec 2011 08:51:04 +0900
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.92 (i686-pc-cygwin)

Chong Yidong wrote:
>   message.el (message-pop-to-buffer): Use pop-to-buffer-same-window
> for last change.

But there's no such function in old Emacsen nor XEmacsen.  Cf.

The main reason using it is to pop up a frame according to
'special-display-regexps' and friends, I guess.  So, I tried
a function that emulates `pop-to-buffer-same-window':

--- message.el~ 2011-12-04 22:06:42.984375000 +0000
+++ message.el  2011-12-06 23:45:56.875000000 +0000
@@ -6388,7 +6388,15 @@
                               "Message already being composed; erase? ")
                            (message nil))))
            (error "Message being composed")))
-      (funcall (or switch-function #'pop-to-buffer-same-window) name)
+      (cond (switch-function
+            (funcall switch-function name))
+           ((fboundp 'pop-to-buffer-same-window)
+            (pop-to-buffer-same-window name))
+           (t
+            (save-window-excursion
+              (pop-to-buffer name))
+            (unless (get-buffer-window name t)
+              (set-window-buffer nil name))))
       (set-buffer name))

Does this get a passing mark?
Tested with Emacs 23.3 and XEmacs 21.4.22.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]