summaryrefslogtreecommitdiff
path: root/cider-overlays.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-07-15 15:55:43 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-07-16 09:39:59 +0100
commitd668a9d2d19eb63536d1c1cb47e382b9aed5ece0 (patch)
treec52db4de86b2760b9c061da4ca367f090e411634 /cider-overlays.el
parent9906b1a8149d60ac9a4463e8361df62dd93a520d (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-overlays.el')
-rw-r--r--cider-overlays.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/cider-overlays.el b/cider-overlays.el
index c751dc09..32cfd3b3 100644
--- a/cider-overlays.el
+++ b/cider-overlays.el
@@ -100,25 +100,28 @@ overlay will be deleted after the next command (this mimics the behaviour
of the echo area).
PROPS are passed to `cider--make-overlay' with a type of result."
- (with-current-buffer (if (markerp where) (marker-buffer where)
- (current-buffer))
- (remove-overlays nil nil 'cider-type 'result)
- (save-excursion
- (when where (goto-char where))
- (let ((o (apply
- #'cider--make-overlay
- (line-beginning-position) (line-end-position)
- 'result
- 'after-string
- (concat (propertize " " 'cursor 1000)
- (propertize cider-eval-result-prefix
- 'face 'cider-result-overlay-face)
- (format "%s" value))
- props)))
- (pcase duration
- ((pred numberp) (run-at-time duration nil #'cider--delete-overlay o))
- (`command (add-hook 'post-command-hook #'cider--remove-result-overlay nil 'local)))
- o))))
+ ;; If the marker points to a dead buffer, don't do anything.
+ (-if-let (buffer (if (markerp where) (marker-buffer where)
+ (current-buffer)))
+ (with-current-buffer buffer
+ (remove-overlays nil nil 'cider-type 'result)
+ (save-excursion
+ (when where (goto-char where))
+ (let ((o (apply
+ #'cider--make-overlay
+ (line-beginning-position) (line-end-position)
+ 'result
+ 'after-string
+ (concat (propertize " " 'cursor 1000)
+ (propertize cider-eval-result-prefix
+ 'face 'cider-result-overlay-face)
+ (format "%s" value))
+ props)))
+ (pcase duration
+ ((pred numberp) (run-at-time duration nil #'cider--delete-overlay o))
+ (`command (add-hook 'post-command-hook #'cider--remove-result-overlay nil 'local)))
+ o)))
+ (message "%s%s" cider-eval-result-prefix value)))
;;; Displaying eval result