@@ -116,6 +116,7 @@ by clicking or navigating to them by other means."
116116 (define-key map " c" #'cider-inspector-set-max-coll-size )
117117 (define-key map " d" #'cider-inspector-def-current-val )
118118 (define-key map " t" #'cider-inspector-tap-current-val )
119+ (define-key map " 1" #'cider-inspector-tap-at-point )
119120 (define-key map [tab] #'cider-inspector-next-inspectable-object )
120121 (define-key map " \C -i" #'cider-inspector-next-inspectable-object )
121122 (define-key map " n" #'cider-inspector-next-inspectable-object )
@@ -386,6 +387,24 @@ current-namespace."
386387 (error " Could not tap the current Inspector value: %s " err))))
387388 (user-error " No CIDER session found" )))
388389
390+ (defun cider-inspector-tap-at-point ()
391+ " Sends the current Inspector current sub-value (per POINT) to `tap>' ."
392+ (interactive )
393+ ; ; NOTE: we don't set `cider-inspector--current-repl' , because we mean to tap the current value of an existing Inspector,
394+ ; ; so whatever repl was used for it, should be used here.
395+ (if cider-inspector--current-repl
396+ (seq-let (property value) (cider-inspector-property-at-point)
397+ (pcase property
398+ (`cider-value-idx
399+ (let* ((idx value)
400+ (response (cider-sync-request:inspect-tap-indexed idx)))
401+ (nrepl-dbind-response response (value err)
402+ (if value
403+ (message " Successfully tapped the Inspector item at point " )
404+ (error " Could not tap the Inspector item at point: %s " err)))))
405+ (_ (error " No object at point " ))))
406+ (user-error " No CIDER session found" )))
407+
389408; ; nREPL interactions
390409(defun cider-sync-request:inspect-pop (&optional v2 )
391410 " Move one level up in the inspector stack,
@@ -520,6 +539,13 @@ instead of just its \"value\" entry."
520539 " Sends current inspector value to tap>."
521540 (cider-nrepl-send-sync-request '(" op" " inspect-tap-current-value" ) cider-inspector--current-repl))
522541
542+ (defun cider-sync-request:inspect-tap-indexed (idx )
543+ " Sends current inspector sub-value to tap>, per IDX."
544+ (cl-assert idx)
545+ (cider-nrepl-send-sync-request `(" op" " inspect-tap-indexed"
546+ " idx" , idx )
547+ cider-inspector--current-repl))
548+
523549(defun cider-sync-request:inspect-expr (expr ns page-size max-atom-length max-coll-size &optional v2 )
524550 " Evaluate EXPR in context of NS and inspect its result.
525551Set the page size in paginated view to PAGE-SIZE, maximum length of atomic
@@ -746,11 +772,11 @@ that value.
7467723. If point is on a range-button fetch and insert the range."
747773 (interactive )
748774 (seq-let (property value) (cider-inspector-property-at-point)
749- (cl-case property
750- (cider-value-idx
775+ (pcase property
776+ (` cider-value-idx
751777 (cider-inspector-push value))
752778 ; ; TODO: range and action handlers
753- (t (error " No object at point " )))))
779+ (_ (error " No object at point " )))))
754780
755781(defun cider-inspector-operate-on-click (event )
756782 " Move to EVENT's position and operate the part."
0 commit comments