Subject: Re: bug#5405: select-frame losing current-buffer

From: Chong Yidong <[email-masked]>
Date: Sun, 17 Jan 2010 15:02:51 -0500

Uday S Reddy <[email-masked]> writes:

> The documentation of make-frame says that current-buffer continues to
> selected in the new frame.  The documentation of select-frame doesn't
> say anything about the matter, but one would normally expect that the
> current-buffer should still remain the same.  However, the following
> example shows that select-frame loses the current-buffer:
>
> (defun testing ()
>   (interactive)
>   (let ((new-buffer (get-buffer-create " testing")))
>     (set-buffer new-buffer)
>     (select-frame (make-frame nil))
>     (if (not (equal (current-buffer) new-buffer))
> 	(debug))))
>
> I presume that the space at the beginning of the buffer name is
> a partial cause of this misbehaviour.

This is deliberate behavior dating back about a decade (frame.c:392).
Buffers whose names start with a space are considered "hidden buffers"
that should not ordinarily be displayed (e.g. they don't show up in
M-x list-buffers either).  I'll update the documentation to mention
this.