[Top][All Lists]

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

bug#5405: select-frame losing current-buffer

From: Uday S Reddy
Subject: bug#5405: select-frame losing current-buffer
Date: Sun, 17 Jan 2010 20:21:24 +0000

Dear Chong,

Thanks very much for the quick response.  But I am not convinced the
hidden buffer idea explains the behaviour I found.  Before doing
select-frame, the "hidden buffer" is the current buffer.  For whatever
reason, the user or the code chose it as the current buffer.  I don't
believe that the buffer should be forcibly dumped and the focus placed
on some other random buffer that happens to be around.

This behaviour was found in maintaining VM which, for some indepdent
reasons, chose a buffer name with a leading space, and some serious
buffer corruption resulted from it.  This seems dangerous, undesirable

I have now modified VM to avoid the leading space.  So the issue
doesn't affect me any more.  But it took me a day's labour to find the
problem.  I hope there won't be others who will get simiarly burned.


Chong Yidong writes:

> Uday S Reddy <address@hidden> 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.

reply via email to

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