From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: don@donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#640: marked as done (Forward: Buffer being killed not current in kill-buffer-hook ) Date: Wed, 24 Sep 2008 13:20:06 -0700 Message-ID: References: <8763oluwrq.fsf@cyd.mit.edu> <874p64wvqb.wl%max@openchat.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1222287606-23708-0" X-Trace: ger.gmane.org 1222288220 26860 80.91.229.12 (24 Sep 2008 20:30:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Sep 2008 20:30:20 +0000 (UTC) To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 24 22:31:16 2008 connect(): Connection refused 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 1Kib0v-0003KP-UJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Sep 2008 22:31:10 +0200 Original-Received: from localhost ([127.0.0.1]:60280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kiazt-0005je-Cj for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Sep 2008 16:30:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kiazn-0005ik-FV for bug-gnu-emacs@gnu.org; Wed, 24 Sep 2008 16:29:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kiazl-0005hN-I6 for bug-gnu-emacs@gnu.org; Wed, 24 Sep 2008 16:29:58 -0400 Original-Received: from [199.232.76.173] (port=49922 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kiazl-0005h8-8R for bug-gnu-emacs@gnu.org; Wed, 24 Sep 2008 16:29:57 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43313) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kiazk-0002j3-FW for bug-gnu-emacs@gnu.org; Wed, 24 Sep 2008 16:29:56 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8OKTsw1025898; Wed, 24 Sep 2008 13:29:54 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m8OKK6rq023749; Wed, 24 Sep 2008 13:20:06 -0700 X-Mailer: MIME-tools 5.420 (Entity 5.420) X-Loop: don@donarmstrong.com X-Emacs-PR-Message: closed 640 X-Emacs-PR-Package: emacs X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list 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:20734 Archived-At: This is a multi-part message in MIME format... ------------=_1222287606-23708-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Wed, 24 Sep 2008 16:14:17 -0400 with message-id <8763oluwrq.fsf@cyd.mit.edu> and subject line Re: Buffer being killed not current in kill-buffer-hook=20 has caused the Emacs bug report #640, regarding Forward: Buffer being killed not current in kill-buffer-hook=20 to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact don@donarmstrong.com immediately.) --=20 640: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D640 Emacs Bug Tracking System Contact don@donarmstrong.com with problems ------------=_1222287606-23708-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.6 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 1 Aug 2008 16:47:08 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m71Gl4ZW028086 for ; Fri, 1 Aug 2008 09:47:05 -0700 Received: from mx10.gnu.org ([199.232.76.166]:60407) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1KOxlX-0002bn-SY for emacs-pretest-bug@gnu.org; Fri, 01 Aug 2008 12:46:08 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1KOxmM-0006kI-Oo for emacs-pretest-bug@gnu.org; Fri, 01 Aug 2008 12:47:02 -0400 Received: from p84-72.acedsl.com ([66.114.84.72]:17975 helo=momoland.openchat.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KOxmL-0006jc-UZ for emacs-pretest-bug@gnu.org; Fri, 01 Aug 2008 12:46:58 -0400 Received: from momoland.openchat.com (localhost [127.0.0.1]) by momoland.openchat.com (Postfix) with ESMTP id 83E50F45674C for ; Fri, 1 Aug 2008 12:22:52 -0400 (EDT) Date: Fri, 01 Aug 2008 12:22:52 -0400 Message-ID: <874p64wvqb.wl%max@openchat.com> From: Max Mikhanosha To: emacs-pretest-bug@gnu.org Subject: Forward: Buffer being killed not current in kill-buffer-hook References: <8763r1obx6.wl%max@openchat.com> User-Agent: Wanderlust/2.15.3 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.0.51 (x86_64-unknown-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Fri_Aug__1_12:22:52_2008-1" X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Greylist: delayed 1442 seconds by postgrey-1.27 at monty-python; Fri, 01 Aug 2008 12:46:55 EDT --Multipart_Fri_Aug__1_12:22:52_2008-1 Content-Type: text/plain; charset=US-ASCII I posted this to emacs-dev, but there was no response. This is still happenning to me with latest CVS build. --Multipart_Fri_Aug__1_12:22:52_2008-1 Content-Type: message/rfc822 Date: Sat, 19 Jul 2008 16:29:25 -0400 Message-ID: <8763r1obx6.wl%max@openchat.com> From: Max Mikhanosha To: emacs-devel@gnu.org Subject: Buffer being killed not current in kill-buffer-hook User-Agent: Wanderlust/2.15.3 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.0.51 (x86_64-unknown-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII When using multi-tty emacsclient, the following piece of code demostrates the problem: DISPLAY is unset, CVS Emacs started with --no-init-file (require 'server) (progn (setq server-name "test") (server-start)) (defun print-current-buffer () (message "current-buffer=%s" (current-buffer))) (add-hook 'kill-buffer-hook 'print-current-buffer) Now from a different screen session, connect with emacsclient like so: "lib-src/emacsclient -c -s test foo". New tty frame will be created. Immeditely kill the buffer, it will ask "Buffer has existing clients" say "yes". emacsclient will disconnect from a server. In the *Messages* buffer on the server frame: When done with a buffer, type C-x # (No files need saving) current-buffer=*scratch* All the code that uses kill-buffer-hook rightfully assumes that the buffer being killed will be current buffer when called, as that is what is stated in the kill-buffer-hook documentation. For example saveplace does not work because of this.. ERC leaves a channel if unrelated buffer is killed on a different terminal, etc. I had fixed this with the following patch, altho I don't know enough about server.el logic to figure out if what it does is ok? Seems to have fixed the bug and not broke anything else: Index: lisp/server.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/server.el,v retrieving revision 1.166 diff -u -b -r1.166 server.el --- lisp/server.el 6 May 2008 07:57:49 -0000 1.166 +++ lisp/server.el 19 Jul 2008 20:28:26 -0000 @@ -1084,7 +1084,8 @@ ;; tell it that it is done, and forget it entirely. (unless buffers (server-log "Close" proc) - (server-delete-client proc))))) + (save-current-buffer + (server-delete-client proc)))))) (when (and (bufferp buffer) (buffer-name buffer)) ;; We may or may not kill this buffer; ;; if we do, do not call server-buffer-done recursively --Multipart_Fri_Aug__1_12:22:52_2008-1-- ------------=_1222287606-23708-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.8 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 640-done) by emacsbugs.donarmstrong.com; 24 Sep 2008 20:13:52 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8OKDnDP022299 for <640-done@emacsbugs.donarmstrong.com>; Wed, 24 Sep 2008 13:13:50 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 6A75D57E189; Wed, 24 Sep 2008 16:14:17 -0400 (EDT) From: Chong Yidong To: Max Mikhanosha Cc: 640-done@emacsbugs.donarmstrong.com Subject: Re: Buffer being killed not current in kill-buffer-hook Date: Wed, 24 Sep 2008 16:14:17 -0400 Message-ID: <8763oluwrq.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > I posted this to emacs-dev, but there was no response. This is still > happenning to me with latest CVS build. Sorry for the delay. I've just checked in a slightly more conservative version of you patch (since I'm not sure it's correct to apply save-current-buffer in all situations). Thanks for the report and the patch. ------------=_1222287606-23708-0--