summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cider-debug.el8
-rw-r--r--cider-overlays.el41
-rw-r--r--nrepl-client.el7
3 files changed, 34 insertions, 22 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*")
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
diff --git a/nrepl-client.el b/nrepl-client.el
index 1dbeeb3f..adb49880 100644
--- a/nrepl-client.el
+++ b/nrepl-client.el
@@ -892,9 +892,10 @@ server responses."
(lambda (response)
(nrepl-dbind-response response (value ns out err status id ex root-ex
session pprint-out)
- (with-current-buffer buffer
- (when (and ns (not (derived-mode-p 'clojure-mode)))
- (setq cider-buffer-ns ns)))
+ (when (buffer-live-p buffer)
+ (with-current-buffer buffer
+ (when (and ns (not (derived-mode-p 'clojure-mode)))
+ (setq cider-buffer-ns ns))))
(cond (value
(when value-handler
(funcall value-handler buffer value)))