From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#6454: 24.0.50; kill-buffer switches current-buffer Date: Fri, 18 Jun 2010 21:12:05 +0200 Message-ID: <4C1BC505.3020501@gmx.at> References: <4C1B643D.1080703@gmx.at> <4C1B83AF.80600@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1276889352 18792 80.91.229.12 (18 Jun 2010 19:29:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Jun 2010 19:29:12 +0000 (UTC) Cc: Helmut Eller , 6454@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 18 21:29:10 2010 connect(): No such file or directory 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.69) (envelope-from ) id 1OPhFV-0004IU-JY for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Jun 2010 21:29:09 +0200 Original-Received: from localhost ([127.0.0.1]:57859 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPhFU-0000V3-Ue for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Jun 2010 15:29:08 -0400 Original-Received: from [140.186.70.92] (port=53837 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPhFM-0000TB-2m for bug-gnu-emacs@gnu.org; Fri, 18 Jun 2010 15:29:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPhFK-0004X6-Mj for bug-gnu-emacs@gnu.org; Fri, 18 Jun 2010 15:28:59 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40647) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPhFK-0004X2-LK for bug-gnu-emacs@gnu.org; Fri, 18 Jun 2010 15:28:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OPgzu-0006Vi-CM; Fri, 18 Jun 2010 15:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Jun 2010 19:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6454 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6454-submit@debbugs.gnu.org id=B6454.127688833625011 (code B ref 6454); Fri, 18 Jun 2010 19:13:02 +0000 Original-Received: (at 6454) by debbugs.gnu.org; 18 Jun 2010 19:12:16 +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 1OPgzA-0006VM-3X for submit@debbugs.gnu.org; Fri, 18 Jun 2010 15:12:16 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OPgz7-0006VF-72 for 6454@debbugs.gnu.org; Fri, 18 Jun 2010 15:12:14 -0400 Original-Received: (qmail invoked by alias); 18 Jun 2010 19:12:07 -0000 Original-Received: from 62-47-61-1.adsl.highway.telekom.at (EHLO [62.47.61.1]) [62.47.61.1] by mail.gmx.net (mp069) with SMTP; 18 Jun 2010 21:12:07 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/C01AE0pnCj+RSk8KYU8gbmVHHKzG2L57osa8Skz VNE+2zEdA2jcp4 User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 18 Jun 2010 15:13:02 -0400 X-detected-operating-system: by eggs.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:37845 Archived-At: >>> I know that kill-buffer should not change current-buffer. >> What about C-x k ;-) > > C-x k is no exception: the kill-buffer function there should not (and > usually will not) change current-buffer (other than in the obvious case > where we kill the current-buffer, obviously). I obviously meant the obvious case ;-) >> So we would have to check whether we want to kill the current buffer and >> not change it if we don't. > > That's right. > >> Unfortunately, there's no proof that the buffer current when calling >> `kill-buffer' is the buffer considered current by the outermost >> calling application. It might be just current because some >> intermittent part (the actual caller of `kill-buffer') wanted to have >> a look at the buffer's local variables. So `kill-buffer' can't be >> sure about the "real identity of the current buffer" either. > > I don't see a problem here. Can you give a more detailed scenario? When `kill-buffer' kills the current buffer it has to find a new current buffer. It does so as follows: if (b == current_buffer) { tem = Fother_buffer (buffer, Qnil, Qnil); Fset_buffer (tem); if (b == current_buffer) return Qnil; } I had code in mind that does something not entirely unreasonable like (dolist (buffer buffer-list) (with-current-buffer buffer (when this-is-a-buffer-that-should-be-killed (kill-buffer)))) where this-is-a-buffer-that-should-be-killed is a buffer-local variable. In this case `kill-buffer' will rotate through all possible candidates in order to make another buffer current. martin