summaryrefslogtreecommitdiff
path: root/cider-inspector.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2016-03-01 16:05:28 +0200
committerBozhidar Batsov <bozhidar@batsov.com>2016-03-01 16:05:28 +0200
commit47b7b1e6c813cf03775cf9abe97196946994d5d6 (patch)
tree88cf7195d9e8b398245304454e3140fcd5bbe768 /cider-inspector.el
parent681621620261ab922bfaf62aa294742ae4e859bd (diff)
Extract a read-and-inspect command from cider-inspect
Diffstat (limited to 'cider-inspector.el')
-rw-r--r--cider-inspector.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/cider-inspector.el b/cider-inspector.el
index 0de90b24..ce8b8cd5 100644
--- a/cider-inspector.el
+++ b/cider-inspector.el
@@ -97,6 +97,14 @@ The page size can be also changed interactively within the inspector."
(cider-inspect-expr (cider-defun-at-point) (cider-current-ns)))
;;;###autoload
+(defun cider-inspect-read-and-inspect ()
+ "Read an expression from the minibuffer and inspect its result."
+ (interactive)
+ (when-let ((expression (cider-read-from-minibuffer "Inspect expression: "
+ (cider-sexp-at-point))))
+ (cider-inspect-expr expression (cider-current-ns))))
+
+;;;###autoload
(defun cider-inspect (&optional arg)
"Inspect the result of the preceding sexp.
@@ -106,9 +114,7 @@ With a second prefix argument it prompts for an expression to eval and inspect."
(pcase arg
(1 (cider-inspect-last-sexp))
(4 (cider-inspect-defun-at-point))
- (16 (when-let ((expression (cider-read-from-minibuffer "Inspect expression: "
- (cider-sexp-at-point))))
- (cider-inspect-expr expression (cider-current-ns))))))
+ (16 (cider-inspect-read-and-inspect))))
;; Operations
(defun cider-inspector--value-handler (_buffer value)