GNU bug report logs -
#640
Forward: Buffer being killed not current in kill-buffer-hook
Previous Next
Reported by: Max Mikhanosha <max <at> openchat.com>
Date: Fri, 1 Aug 2008 16:55:04 UTC
Severity: normal
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 640 in the body.
You can then email your comments to 640 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#640
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Max Mikhanosha <max <at> openchat.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
[Message part 1 (text/plain, inline)]
I posted this to emacs-dev, but there was no response. This is still
happenning to me with latest CVS build.
[Message part 2 (message/rfc822, inline)]
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
Reply sent to
Chong Yidong <cyd <at> stupidchicken.com>
:
You have taken responsibility.
Full text and
rfc822 format available.
Notification sent to
Max Mikhanosha <max <at> openchat.com>
:
bug acknowledged by developer.
Full text and
rfc822 format available.
Message #10 received at 640-done <at> emacsbugs.donarmstrong.com (full text, mbox):
> 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.
bug archived.
Request was from
Debbugs Internal Request <don <at> donarmstrong.com>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Thu, 23 Oct 2008 14:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 16 years and 296 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.