Skip to content

Commit

Permalink
[Fix #1490] Don't show the inspector buffer if evaluation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cichli committed Dec 29, 2015
1 parent df40718 commit 740108f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cider-debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@ needed. It is expected to contain at least \"key\", \"input-type\", and
(setq cider--debug-mode-response response)
(cider--debug-mode 1)))
(when inspect
(cider-inspector--value-handler nil inspect)
(cider-inspector--done-handler (current-buffer))))
(cider-inspector--value-handler nil inspect)))
;; If something goes wrong, we send a "quit" or the session hangs.
(error (cider-debug-mode-send-reply ":quit" key)
(message "Error encountered while handling the debug message: %S" e)))))
Expand Down
10 changes: 3 additions & 7 deletions cider-inspector.el
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,15 @@ With a second prefix argument it prompts for an expression to eval and inspect."
;; Operations
(defun cider-inspector--value-handler (_buffer value)
(cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode)
(cider-inspector-render cider-inspector-buffer value))
(cider-inspector-render cider-inspector-buffer value)
(cider-popup-buffer-display cider-inspector-buffer t))

(defun cider-inspector--out-handler (_buffer value)
(cider-emit-interactive-eval-output value))

(defun cider-inspector--err-handler (_buffer err)
(cider-emit-interactive-eval-err-output err))

(defun cider-inspector--done-handler (buffer)
(when (get-buffer cider-inspector-buffer)
(with-current-buffer buffer
(cider-popup-buffer-display cider-inspector-buffer t))))

(defun cider-inspector-response-handler (buffer)
"Create an inspector response handler for BUFFER.
Expand All @@ -139,7 +135,7 @@ Used for all inspector nREPL ops."
#'cider-inspector--value-handler
#'cider-inspector--out-handler
#'cider-inspector--err-handler
#'cider-inspector--done-handler))
#'identity))

(defun cider-inspect-expr (expr ns)
"Evaluate EXPR in NS and inspect its value."
Expand Down

0 comments on commit 740108f

Please sign in to comment.