From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uday S Reddy Newsgroups: gmane.emacs.bugs Subject: bug#5405: select-frame losing current-buffer Date: Sun, 17 Jan 2010 20:21:24 +0000 Message-ID: <19283.28996.281000.798673@gargle.gargle.HOWL> References: <87my0c7b4k.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1263760779 28395 80.91.229.12 (17 Jan 2010 20:39:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Jan 2010 20:39:39 +0000 (UTC) Cc: 5405@debbugs.gnu.org, Uday S Reddy To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 17 21:39:31 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NWbuD-0006nU-Hp for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Jan 2010 21:39:29 +0100 Original-Received: from localhost ([127.0.0.1]:37048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWbuE-0004UC-GW for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Jan 2010 15:39:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWbu8-0004U5-NR for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2010 15:39:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWbu3-0004Sm-RR for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2010 15:39:24 -0500 Original-Received: from [199.232.76.173] (port=40103 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWbu3-0004Sg-LP for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2010 15:39:19 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47762) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NWbu3-0004Tz-Dm for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2010 15:39:19 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NWbdJ-0004HR-SH; Sun, 17 Jan 2010 15:22:01 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Uday S Reddy Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Jan 2010 20:22:01 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5405 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 5405-submit@debbugs.gnu.org id=B5405.126375970616446 (code B ref 5405); Sun, 17 Jan 2010 20:22:01 +0000 Original-Received: (at 5405) by debbugs.gnu.org; 17 Jan 2010 20:21:46 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NWbd4-0004HD-6B for submit@debbugs.gnu.org; Sun, 17 Jan 2010 15:21:46 -0500 Original-Received: from sun61.bham.ac.uk ([147.188.128.150]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NWbd2-0004H6-5i for 5405@debbugs.gnu.org; Sun, 17 Jan 2010 15:21:44 -0500 Original-Received: from [147.188.128.127] (helo=bham.ac.uk) by sun61.bham.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1NWbcw-0001aH-O1; Sun, 17 Jan 2010 20:21:38 +0000 Original-Received: from mx1.cs.bham.ac.uk ([147.188.192.53]) by bham.ac.uk with esmtp (Exim 4.43) id 1NWbcw-0002Qa-E9; Sun, 17 Jan 2010 20:21:38 +0000 Original-Received: from gromit.cs.bham.ac.uk ([147.188.193.16] helo=MARUTI.cs.bham.ac.uk) by mx1.cs.bham.ac.uk with esmtp (Exim 4.51) id 1NWbcw-0008K4-5T; Sun, 17 Jan 2010 20:21:38 +0000 In-Reply-To: <87my0c7b4k.fsf@stupidchicken.com> X-Mailer: VM 8.1.0-beta under 22.3.1 (i386-mingw-nt5.1.2600) X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -3.3 (---) Resent-Date: Sun, 17 Jan 2010 15:22:01 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:34430 Archived-At: 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 behaviour. 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. Cheers, Uday Chong Yidong writes: > Uday S Reddy 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. > >