diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-07-15 15:55:43 +0100 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-07-16 09:39:59 +0100 |
commit | d668a9d2d19eb63536d1c1cb47e382b9aed5ece0 (patch) | |
tree | c52db4de86b2760b9c061da4ca367f090e411634 /cider-debug.el | |
parent | 9906b1a8149d60ac9a4463e8361df62dd93a520d (diff) |
Quit the debugger when the buffer is killed or reverted
Add some safeguards to stop the debugger when the buffer is killed or
reverted, so you don't get stuck in an unrecoverable debugging
session.
Diffstat (limited to 'cider-debug.el')
-rw-r--r-- | cider-debug.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cider-debug.el b/cider-debug.el index 9c4fb2f8..35a1824e 100644 --- a/cider-debug.el +++ b/cider-debug.el @@ -298,6 +298,8 @@ In order to work properly, this mode must be activated by (if cider--debug-mode-response (nrepl-dbind-response cider--debug-mode-response (input-type) (setq-local tool-bar-map cider--debug-mode-tool-bar-map) + (add-hook 'kill-buffer-hook #'cider--debug-quit nil 'local) + (add-hook 'before-revert-hook #'cider--debug-quit nil 'local) (unless (consp input-type) (error "debug-mode activated on a message not asking for commands: %s" cider--debug-mode-response)) ;; Integrate with eval commands. @@ -381,6 +383,12 @@ specific message." #'ignore) (ignore-errors (cider--debug-mode -1))) +(defun cider--debug-quit () + "Send a :quit reply to the debugger. Used in hooks." + (when cider--debug-mode + (cider-debug-mode-send-reply ":quit") + (message "Quitting debug session"))) + ;;; Movement logic (defconst cider--debug-buffer-format "*cider-debug %s*") |