branch: elpa/cider
commit 9dc5107e8b48dbd5839df03ce533c4afa3682fb5
Author: Oleksandr Yakushev <a...@bytopia.org>
Commit: Bozhidar Batsov <bozhi...@batsov.dev>

    [inspector] Remove functions that don't bring value
---
 cider-inspector.el | 143 +++++++++++------------------------------------------
 1 file changed, 29 insertions(+), 114 deletions(-)

diff --git a/cider-inspector.el b/cider-inspector.el
index e8de3bf819..2a325eaca1 100644
--- a/cider-inspector.el
+++ b/cider-inspector.el
@@ -244,18 +244,17 @@ In particular, it does not read `cider-sexp-at-point'."
                         ns)))
 
 (defun cider-inspector-pop ()
-  "Pop the last value off the inspector stack and render it.
-See `cider-sync-request:inspect-pop' and `cider-inspector--render-value'."
+  "Pop the last value off the inspector stack and render it."
   (interactive)
-  (let ((result (cider-sync-request:inspect-pop)))
+  (let ((result (cider-nrepl-send-sync-request `("op" "inspect-pop"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result :pop))))
 
 (defun cider-inspector-push (idx)
-  "Inspect the value at IDX in the inspector stack and render it.
-See `cider-sync-request:inspect-push' and `cider-inspector--render-value'"
+  "Inspect the value at IDX in the inspector stack and render it."
   (interactive)
-  (let ((result (cider-sync-request:inspect-push idx)))
+  (let ((result (cider-nrepl-send-sync-request `("op" "inspect-push"
+                                                 "idx" ,idx))))
     (when (nrepl-dict-get result "value")
       (push (point) cider-inspector-location-stack)
       (cider-inspector--render-value result :next-inspectable))))
@@ -269,33 +268,29 @@ If EX-DATA is true, inspect ex-data of the exception 
instead."
                  `("op" "inspect-last-exception"
                    "index" ,index
                    ,@(when ex-data
-                       `("ex-data" "true")))
-                 (cider-current-repl))))
+                       `("ex-data" "true"))))))
     (when (nrepl-dict-get result "value")
       (setq cider-inspector-location-stack nil)
       (cider-inspector--render-value result :next-inspectable))))
 
 (defun cider-inspector-previous-sibling ()
-  "Inspect the previous sibling value within a sequential parent.
-See `cider-sync-request:inspect-previous-sibling' and 
`cider-inspector--render-value'"
+  "Inspect the previous sibling value within a sequential parent."
   (interactive)
-  (let ((result (cider-sync-request:inspect-previous-sibling)))
+  (let ((result (cider-nrepl-send-sync-request `("op" 
"inspect-previous-sibling"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result))))
 
 (defun cider-inspector-next-sibling ()
-  "Inspect the next sibling value within a sequential parent.
-See `cider-sync-request:inspect-next-sibling' and 
`cider-inspector--render-value'"
+  "Inspect the next sibling value within a sequential parent."
   (interactive)
-  (let ((result (cider-sync-request:inspect-next-sibling)))
+  (let ((result (cider-nrepl-send-sync-request `("op" 
"inspect-next-sibling"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result))))
 
 (defun cider-inspector--refresh-with-opts (&rest opts)
   "Invokes `inspect-refresh' op with supplied extra OPTS.
 Re-renders the currently inspected value."
-  (let ((result (cider-nrepl-send-sync-request `("op" "inspect-refresh" ,@opts)
-                                               (cider-current-repl))))
+  (let ((result (cider-nrepl-send-sync-request `("op" "inspect-refresh" 
,@opts))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result))))
 
@@ -309,7 +304,7 @@ Re-renders the currently inspected value."
 
 Does nothing if already on the last page."
   (interactive)
-  (let ((result (cider-sync-request:inspect-next-page)))
+  (let ((result (cider-nrepl-send-sync-request '("op" "inspect-next-page"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result))))
 
@@ -318,7 +313,7 @@ Does nothing if already on the last page."
 
 Does nothing if already on the first page."
   (interactive)
-  (let ((result (cider-sync-request:inspect-prev-page)))
+  (let ((result (cider-nrepl-send-sync-request '("op" "inspect-prev-page"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result))))
 
@@ -352,25 +347,21 @@ MAX-NESTED-DEPTH is the new value."
   ;; Disable hint about analytics feature so that it is never displayed again.
   (when cider-inspector-display-analytics-hint
     (customize-set-variable 'cider-inspector-display-analytics-hint nil))
-  (let ((result (cider-nrepl-send-sync-request `("op" 
"inspect-display-analytics")
-                                               (cider-current-repl))))
+  (let ((result (cider-nrepl-send-sync-request `("op" 
"inspect-display-analytics"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result :next-inspectable))))
 
 (defun cider-inspector-toggle-pretty-print ()
   "Toggle the pretty printing of values in the inspector."
   (interactive)
-  (let ((result (cider-nrepl-send-sync-request
-                 `("op" "inspect-toggle-pretty-print")
-                 (cider-current-repl))))
+  (let ((result (cider-nrepl-send-sync-request `("op" 
"inspect-toggle-pretty-print"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result))))
 
 (defun cider-inspector-toggle-view-mode ()
   "Toggle the view mode of the inspector between normal and object view mode."
   (interactive)
-  (let ((result (cider-nrepl-send-sync-request `("op" 
"inspect-toggle-view-mode")
-                                               (cider-current-repl))))
+  (let ((result (cider-nrepl-send-sync-request `("op" 
"inspect-toggle-view-mode"))))
     (when (nrepl-dict-get result "value")
       (cider-inspector--render-value result :next-inspectable))))
 
@@ -402,7 +393,9 @@ current-namespace."
   (interactive (let ((ns (cider-current-ns)))
                  (list (cider-inspector--read-var-name-from-user ns)
                        ns)))
-  (when-let* ((result (cider-sync-request:inspect-def-current-val ns 
var-name)))
+  (when-let* ((result (cider-nrepl-send-sync-request `("op" 
"inspect-def-current-value"
+                                                       "ns" ,ns
+                                                       "var-name" ,var-name))))
     (cider-inspector--render-value result)
     (message "Defined current inspector value as #'%s/%s" ns var-name)))
 
@@ -415,13 +408,12 @@ current-namespace."
     (cider-nrepl-send-request
      `("op" "inspect-print-current-value"
        ,@(cider--nrepl-print-request-plist fill-column))
-     (cider-popup-eval-handler buffer)
-     (cider-current-repl))))
+     (cider-popup-eval-handler buffer))))
 
 (defun cider-inspector-tap-current-val ()
   "Sends the current Inspector current value to `tap>'."
   (interactive)
-  (let ((response (cider-sync-request:inspect-tap-current-val)))
+  (let ((response (cider-nrepl-send-sync-request '("op" 
"inspect-tap-current-value"))))
     (nrepl-dbind-response response (value err)
       (if value
           (message "Successfully tapped the current Inspector value")
@@ -433,94 +425,17 @@ current-namespace."
   (seq-let (property value) (cider-inspector-property-at-point)
     (pcase property
       (`cider-value-idx
-       (let* ((idx value)
-              (response (cider-sync-request:inspect-tap-indexed idx)))
-         (nrepl-dbind-response response (value err)
-           (if value
-               (message "Successfully tapped the Inspector item at point")
-             (error "Could not tap the Inspector item at point: %s" err)))))
+       (cl-assert value)
+       (nrepl-dbind-response (cider-nrepl-send-sync-request `("op" 
"inspect-tap-indexed"
+                                                              "idx" ,value))
+           (value err)
+         (if value
+             (message "Successfully tapped the Inspector item at point")
+           (error "Could not tap the Inspector item at point: %s" err))))
       (_ (error "No object at point")))))
 
 ;; nREPL interactions
 
-(defun cider-sync-request:inspect-pop ()
-  "Move one level up in the inspector stack."
-  (cider-nrepl-send-sync-request `("op" "inspect-pop")
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-push (idx)
-  "Inspect the inside value specified by IDX."
-  (cider-nrepl-send-sync-request `("op" "inspect-push"
-                                   "idx" ,idx)
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-previous-sibling ()
-  "Inspect the previous sibling value within a sequential parent."
-  (cider-nrepl-send-sync-request `("op" "inspect-previous-sibling")
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-next-sibling ()
-  "Inspect the next sibling value within a sequential parent."
-  (cider-nrepl-send-sync-request `("op" "inspect-next-sibling")
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-next-page ()
-  "Jump to the next page in paginated collection view."
-  (cider-nrepl-send-sync-request '("op" "inspect-next-page")
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-prev-page ()
-  "Jump to the previous page in paginated collection view."
-  (cider-nrepl-send-sync-request '("op" "inspect-prev-page")
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-set-page-size (page-size)
-  "Set the page size in paginated view to PAGE-SIZE."
-  (declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
-  (cider-nrepl-send-sync-request `("op" "inspect-set-page-size"
-                                   "page-size" ,page-size)
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-set-max-atom-length (max-length)
-  "Set the max length of nested atoms to MAX-LENGTH."
-  (declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
-  (cider-nrepl-send-sync-request `("op" "inspect-set-max-atom-length"
-                                   "max-atom-length" ,max-length)
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-set-max-coll-size (max-size)
-  "Set the maximum number of nested collection members to display to MAX-SIZE."
-  (declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
-  (cider-nrepl-send-sync-request `("op" "inspect-set-max-coll-size"
-                                   "max-coll-size" ,max-size)
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-set-max-nested-depth (max-nested-depth)
-  "Set the level of nesting to display before truncating to MAX-NESTED-DEPTH."
-  (declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
-  (cider-nrepl-send-sync-request `("op" "inspect-set-max-nested-depth"
-                                   "max-nested-depth" ,max-nested-depth)
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-def-current-val (ns var-name)
-  "Defines a var with VAR-NAME in NS with the current inspector value."
-  (cider-nrepl-send-sync-request `("op" "inspect-def-current-value"
-                                   "ns" ,ns
-                                   "var-name" ,var-name)
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-tap-current-val ()
-  "Sends current inspector value to tap>."
-  (cider-nrepl-send-sync-request '("op" "inspect-tap-current-value")
-                                 (cider-current-repl)))
-
-(defun cider-sync-request:inspect-tap-indexed (idx)
-  "Sends current inspector sub-value to tap>, per IDX."
-  (cl-assert idx)
-  (cider-nrepl-send-sync-request `("op" "inspect-tap-indexed"
-                                   "idx" ,idx)
-                                 (cider-current-repl)))
-
 (defun cider-sync-request:inspect-expr (expr ns)
   "Evaluate EXPR in context of NS and inspect its result.
 Set the page size in paginated view to PAGE-SIZE, maximum length of atomic
@@ -541,7 +456,7 @@ MAX-COLL-SIZE if non nil."
                   `("display-analytics-hint" "true"))
               ,@(when cider-inspector-pretty-print
                   `("pretty-print" "true"))))
-    (cider-nrepl-send-sync-request (cider-current-repl))))
+    (cider-nrepl-send-sync-request)))
 
 (declare-function cider-set-buffer-ns "cider-mode")
 

Reply via email to