all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: /srv/bzr/emacs/trunk r106599: message.el (message-pop-to-buffer): Use pop-to-buffer-same-window for last change.
       [not found] <E1RX1do-00036n-01@vcs.savannah.gnu.org>
@ 2011-12-06 23:51 ` Katsumi Yamaoka
  2011-12-07  5:18   ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2011-12-06 23:51 UTC (permalink / raw)
  To: Chong Yidong; +Cc: ding, emacs-devel

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.
http://news.gmane.org/group/gmane.emacs.gnus.general/thread=80641

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))
     (erase-buffer)
     (message-mode)))

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: /srv/bzr/emacs/trunk r106599: message.el (message-pop-to-buffer): Use pop-to-buffer-same-window for last change.
  2011-12-06 23:51 ` /srv/bzr/emacs/trunk r106599: message.el (message-pop-to-buffer): Use pop-to-buffer-same-window for last change Katsumi Yamaoka
@ 2011-12-07  5:18   ` Chong Yidong
  2011-12-07  6:08     ` Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2011-12-07  5:18 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: ding, emacs-devel

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> But there's no such function in old Emacsen nor XEmacsen.  Cf.
> http://news.gmane.org/group/gmane.emacs.gnus.general/thread=80641

Sorry about that.

> -      (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))))

If pop-to-buffer-same-window is not available, you can just use
pop-to-buffer.  In previous version of Emacs, the mail buffer is treated
specially via same-window-buffer-names, so pop-to-buffer will do the
right thing.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: /srv/bzr/emacs/trunk r106599: message.el (message-pop-to-buffer): Use pop-to-buffer-same-window for last change.
  2011-12-07  5:18   ` Chong Yidong
@ 2011-12-07  6:08     ` Katsumi Yamaoka
  0 siblings, 0 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2011-12-07  6:08 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Steinar Bang, ding, emacs-devel

Chong Yidong wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> But there's no such function in old Emacsen nor XEmacsen.  Cf.
>> http://news.gmane.org/group/gmane.emacs.gnus.general/thread=80641

[...]

> If pop-to-buffer-same-window is not available, you can just use
> pop-to-buffer.  In previous version of Emacs, the mail buffer is treated
> specially via same-window-buffer-names, so pop-to-buffer will do the
> right thing.

I see.  Thanks.  Fixed in Emacs and Gnus trunks.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-07  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1RX1do-00036n-01@vcs.savannah.gnu.org>
2011-12-06 23:51 ` /srv/bzr/emacs/trunk r106599: message.el (message-pop-to-buffer): Use pop-to-buffer-same-window for last change Katsumi Yamaoka
2011-12-07  5:18   ` Chong Yidong
2011-12-07  6:08     ` Katsumi Yamaoka

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.