From 4c79e4f37969528483b3558a231977a1be2d4f51 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 9 Apr 2002 23:11:42 +0000 Subject: *** no comment *** --- chess-display.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'chess-display.el') diff --git a/chess-display.el b/chess-display.el index 68aeea4..f45429e 100644 --- a/chess-display.el +++ b/chess-display.el @@ -87,13 +87,19 @@ (funcall handler 'initialize) (setq chess-display-event-handler handler chess-display-perspective perspective) + (add-hook 'kill-buffer-hook 'chess-display-on-kill nil t) (current-buffer)))) -(defsubst chess-display-destroy (display) +(defun chess-display-on-kill () + "Function called when the buffer is killed." + (chess-display-detach-game nil)) + +(defun chess-display-destroy (display) "Destroy a chess display object, killing all of its buffers." (let ((buf (or display (current-buffer)))) - (if (buffer-live-p buf) - (kill-buffer buf)))) + (when (buffer-live-p buf) + (chess-display-detach-game display) + (kill-buffer buf)))) (defsubst chess-display-perspective (display) (chess-with-current-buffer display -- cgit v1.2.3