emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/slime-volleyball daa207c 18/27: Properly clean up when


From: Thomas Fitzsimmons
Subject: [elpa] externals/slime-volleyball daa207c 18/27: Properly clean up when buffer is killed.
Date: Sun, 22 Nov 2020 18:05:18 -0500 (EST)

branch: externals/slime-volleyball
commit daa207cf8812d386d17ad4a2e1e99188c3dfde5e
Author: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>

    Properly clean up when buffer is killed.
    
    When the buffer is killed (e.g., by C-x k) the timers are not cleaned up
    properly.  By adding a `kill-buffer-hook' this can be prevented.
    
    Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 slime-volleyball.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/slime-volleyball.el b/slime-volleyball.el
index 5675bf0..09e613f 100644
--- a/slime-volleyball.el
+++ b/slime-volleyball.el
@@ -1741,10 +1741,14 @@
   (setq slime-volleyball-unpause-function
         'slime-volleyball-introduce-opponent)
   (slime-volleyball-pause "Press SPC or 2 to Start")
+  (add-hook 'kill-buffer-hook
+            (lambda ()
+              (slime-volleyball-quit 'force-quit 'no-kill))
+            nil 'local)
   (with-current-buffer (get-buffer-create "*slime-volleyball*")
     (use-local-map slime-volleyball-mode-map)))
 
-(defun slime-volleyball-quit (&optional force-quit)
+(defun slime-volleyball-quit (&optional force-quit no-kill)
   (interactive)
   (when (or force-quit
             (y-or-n-p "Quit Slime Volleyball?"))
@@ -1754,7 +1758,8 @@
     (slime-volleyball-scrub-timer-list 'slime-volleyball-render)
     (slime-volleyball-scrub-timer-list
      'slime-volleyball-eval-god-mode-variables)
-    (when (get-buffer "*slime-volleyball*")
+    (when (and (not no-kill)
+               (get-buffer "*slime-volleyball*"))
       (kill-buffer "*slime-volleyball*"))))
 
 (provide 'slime-volleyball)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]