@@ -216,11 +216,6 @@ This is used as an alternative to the built-in `last-command'. Whenever we
216
216
invoke any command through \\ [execute-extended-command] and its variants,
217
217
the value of `last-command' is not set to the command it invokes." )
218
218
219
- (defvar cider-inspector--current-repl nil
220
- " Contains the reference to the REPL where inspector was last invoked from.
221
- This is needed for internal inspector buffer operations (push,
222
- pop) to execute against the correct REPL session." )
223
-
224
219
; ; Operations
225
220
;;;### autoload
226
221
(defun cider-inspect-expr (expr ns )
@@ -229,7 +224,6 @@ Interactively, EXPR is read from the minibuffer, and NS the
229
224
current buffer's namespace."
230
225
(interactive (list (cider-read-from-minibuffer " Inspect expression: " (cider-sexp-at-point))
231
226
(cider-current-ns)))
232
- (setq cider-inspector--current-repl (cider-current-repl))
233
227
(let ((result (cider-sync-request:inspect-expr expr ns)))
234
228
(when (nrepl-dict-get result " value" )
235
229
(cider-inspector--render-value result))))
@@ -267,7 +261,6 @@ See `cider-sync-request:inspect-push' and `cider-inspector--render-value'"
267
261
" Inspects the exception in the cause stack identified by INDEX."
268
262
(interactive )
269
263
(cl-assert (numberp index))
270
- (setq cider-inspector--current-repl (cider-current-repl))
271
264
(let ((result (cider-sync-request:inspect-last-exception index)))
272
265
(when (nrepl-dict-get result " value" )
273
266
(push (point ) cider-inspector-location-stack)
@@ -298,7 +291,7 @@ See `cider-sync-request:inspect-next-sibling' and `cider-inspector--render-value
298
291
" Invokes `inspect-refresh' op with supplied extra OPTS.
299
292
Re-renders the currently inspected value."
300
293
(let ((result (cider-nrepl-send-sync-request `(" op" " inspect-refresh" ,@opts )
301
- cider-inspector-- current-repl)))
294
+ ( cider-current-repl) )))
302
295
(when (nrepl-dict-get result " value" )
303
296
(cider-inspector--render-value result))))
304
297
@@ -355,7 +348,7 @@ MAX-NESTED-DEPTH is the new value."
355
348
" Toggle the view mode of the inspector between normal and object view mode."
356
349
(interactive )
357
350
(let ((result (cider-nrepl-send-sync-request `(" op" " inspect-toggle-view-mode" )
358
- cider-inspector-- current-repl)))
351
+ ( cider-current-repl) )))
359
352
(when (nrepl-dict-get result " value" )
360
353
(cider-inspector--render-value result))))
361
354
@@ -394,120 +387,112 @@ current-namespace."
394
387
(defun cider-inspector-tap-current-val ()
395
388
" Sends the current Inspector current value to `tap>' ."
396
389
(interactive )
397
- ; ; NOTE: we don't set `cider-inspector--current-repl' , because we mean to tap the current value of an existing Inspector,
398
- ; ; so whatever repl was used for it, should be used here.
399
- (if cider-inspector--current-repl
400
- (let ((response (cider-sync-request:inspect-tap-current-val)))
401
- (nrepl-dbind-response response (value err)
402
- (if value
403
- (message " Successfully tapped the current Inspector value " )
404
- (error " Could not tap the current Inspector value: %s " err))))
405
- (user-error " No CIDER session found" )))
390
+ (let ((response (cider-sync-request:inspect-tap-current-val)))
391
+ (nrepl-dbind-response response (value err)
392
+ (if value
393
+ (message " Successfully tapped the current Inspector value " )
394
+ (error " Could not tap the current Inspector value: %s " err)))))
406
395
407
396
(defun cider-inspector-tap-at-point ()
408
397
" Sends the current Inspector current sub-value (per POINT) to `tap>' ."
409
398
(interactive )
410
- ; ; NOTE: we don't set `cider-inspector--current-repl' , because we mean to tap the current value of an existing Inspector,
411
- ; ; so whatever repl was used for it, should be used here.
412
- (if cider-inspector--current-repl
413
- (seq-let (property value) (cider-inspector-property-at-point)
414
- (pcase property
415
- (`cider-value-idx
416
- (let* ((idx value)
417
- (response (cider-sync-request:inspect-tap-indexed idx)))
418
- (nrepl-dbind-response response (value err)
419
- (if value
420
- (message " Successfully tapped the Inspector item at point " )
421
- (error " Could not tap the Inspector item at point: %s " err)))))
422
- (_ (error " No object at point " ))))
423
- (user-error " No CIDER session found" )))
399
+ (seq-let (property value) (cider-inspector-property-at-point)
400
+ (pcase property
401
+ (`cider-value-idx
402
+ (let* ((idx value)
403
+ (response (cider-sync-request:inspect-tap-indexed idx)))
404
+ (nrepl-dbind-response response (value err)
405
+ (if value
406
+ (message " Successfully tapped the Inspector item at point " )
407
+ (error " Could not tap the Inspector item at point: %s " err)))))
408
+ (_ (error " No object at point " )))))
424
409
425
410
; ; nREPL interactions
426
411
(defun cider-sync-request:inspect-pop ()
427
412
" Move one level up in the inspector stack."
428
413
(cider-nrepl-send-sync-request `(" op" " inspect-pop" )
429
- cider-inspector-- current-repl))
414
+ ( cider-current-repl) ))
430
415
431
416
(defun cider-sync-request:inspect-push (idx )
432
417
" Inspect the inside value specified by IDX."
433
418
(cider-nrepl-send-sync-request `(" op" " inspect-push"
434
419
" idx" , idx )
435
- cider-inspector-- current-repl))
420
+ ( cider-current-repl) ))
436
421
437
422
(defun cider-sync-request:inspect-previous-sibling ()
438
423
" Inspect the previous sibling value within a sequential parent."
439
424
(cider-nrepl-send-sync-request `(" op" " inspect-previous-sibling" )
440
- cider-inspector-- current-repl))
425
+ ( cider-current-repl) ))
441
426
442
427
;;;### autoload
443
428
(defun cider-sync-request:inspect-last-exception (index )
444
429
" Inspects the exception in the cause stack identified by INDEX."
445
430
(cl-assert (numberp index))
446
431
(cider-nrepl-send-sync-request `(" op" " inspect-last-exception"
447
432
" index" , index )
448
- cider-inspector-- current-repl))
433
+ ( cider-current-repl) ))
449
434
450
435
(defun cider-sync-request:inspect-next-sibling ()
451
436
" Inspect the next sibling value within a sequential parent."
452
437
(cider-nrepl-send-sync-request `(" op" " inspect-next-sibling" )
453
- cider-inspector-- current-repl))
438
+ ( cider-current-repl) ))
454
439
455
440
(defun cider-sync-request:inspect-next-page ()
456
441
" Jump to the next page in paginated collection view."
457
442
(cider-nrepl-send-sync-request '(" op" " inspect-next-page" )
458
- cider-inspector-- current-repl))
443
+ ( cider-current-repl) ))
459
444
460
445
(defun cider-sync-request:inspect-prev-page ()
461
446
" Jump to the previous page in paginated collection view."
462
447
(cider-nrepl-send-sync-request '(" op" " inspect-prev-page" )
463
- cider-inspector-- current-repl))
448
+ ( cider-current-repl) ))
464
449
465
450
(defun cider-sync-request:inspect-set-page-size (page-size )
466
451
" Set the page size in paginated view to PAGE-SIZE."
467
452
(declare (obsolete " use `inspect-refresh' op instead." " 1.15.0" ))
468
453
(cider-nrepl-send-sync-request `(" op" " inspect-set-page-size"
469
454
" page-size" , page-size )
470
- cider-inspector-- current-repl))
455
+ ( cider-current-repl) ))
471
456
472
457
(defun cider-sync-request:inspect-set-max-atom-length (max-length )
473
458
" Set the max length of nested atoms to MAX-LENGTH."
474
459
(declare (obsolete " use `inspect-refresh' op instead." " 1.15.0" ))
475
460
(cider-nrepl-send-sync-request `(" op" " inspect-set-max-atom-length"
476
461
" max-atom-length" , max-length )
477
- cider-inspector-- current-repl))
462
+ ( cider-current-repl) ))
478
463
479
464
(defun cider-sync-request:inspect-set-max-coll-size (max-size )
480
465
" Set the maximum number of nested collection members to display to MAX-SIZE."
481
466
(declare (obsolete " use `inspect-refresh' op instead." " 1.15.0" ))
482
467
(cider-nrepl-send-sync-request `(" op" " inspect-set-max-coll-size"
483
468
" max-coll-size" , max-size )
484
- cider-inspector-- current-repl))
469
+ ( cider-current-repl) ))
485
470
486
471
(defun cider-sync-request:inspect-set-max-nested-depth (max-nested-depth )
487
472
" Set the level of nesting to display before truncating to MAX-NESTED-DEPTH."
488
473
(declare (obsolete " use `inspect-refresh' op instead." " 1.15.0" ))
489
474
(cider-nrepl-send-sync-request `(" op" " inspect-set-max-nested-depth"
490
475
" max-nested-depth" , max-nested-depth )
491
- cider-inspector-- current-repl))
476
+ ( cider-current-repl) ))
492
477
493
478
(defun cider-sync-request:inspect-def-current-val (ns var-name )
494
479
" Defines a var with VAR-NAME in NS with the current inspector value."
495
480
(cider-nrepl-send-sync-request `(" op" " inspect-def-current-value"
496
481
" ns" , ns
497
482
" var-name" , var-name )
498
- cider-inspector-- current-repl))
483
+ ( cider-current-repl) ))
499
484
500
485
(defun cider-sync-request:inspect-tap-current-val ()
501
486
" Sends current inspector value to tap>."
502
487
(cider-nrepl-send-sync-request '(" op" " inspect-tap-current-value" )
503
- cider-inspector-- current-repl))
488
+ ( cider-current-repl) ))
504
489
505
490
(defun cider-sync-request:inspect-tap-indexed (idx )
506
491
" Sends current inspector sub-value to tap>, per IDX."
507
492
(cl-assert idx)
508
493
(cider-nrepl-send-sync-request `(" op" " inspect-tap-indexed"
509
494
" idx" , idx )
510
- cider-inspector-- current-repl))
495
+ ( cider-current-repl) ))
511
496
512
497
(defun cider-sync-request:inspect-expr (expr ns )
513
498
" Evaluate EXPR in context of NS and inspect its result.
@@ -525,7 +510,7 @@ MAX-COLL-SIZE if non nil."
525
510
`(" max-coll-size" , cider-inspector-max-coll-size ))
526
511
,@(when cider-inspector-max-nested-depth
527
512
`(" max-nested-depth" , cider-inspector-max-nested-depth ))))
528
- (cider-nrepl-send-sync-request cider-inspector-- current-repl)))
513
+ (cider-nrepl-send-sync-request ( cider-current-repl) )))
529
514
530
515
(declare-function cider-set-buffer-ns " cider-mode" )
531
516
@@ -549,7 +534,8 @@ It can either be a value directly or a inspector response that contains
549
534
(local-variable-p 'truncate-lines b)))
550
535
(truncate-lines-p (when-let* ((b (get-buffer cider-inspector-buffer))
551
536
(continue truncate-lines-defined))
552
- (buffer-local-value 'truncate-lines b))))
537
+ (buffer-local-value 'truncate-lines b)))
538
+ (repl (cider-current-repl)))
553
539
(cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary )
554
540
(cider-inspector-render cider-inspector-buffer value
555
541
:font-size font-size
@@ -559,6 +545,7 @@ It can either be a value directly or a inspector response that contains
559
545
(when cider-inspector-fill-frame (delete-other-windows ))
560
546
(ignore-errors (cider-inspector-next-inspectable-object 1 ))
561
547
(with-current-buffer cider-inspector-buffer
548
+ (setq cider--ancillary-buffer-repl repl)
562
549
(cider-set-buffer-ns ns)
563
550
(when (eq cider-inspector-last-command 'cider-inspector-pop )
564
551
(setq cider-inspector-last-command nil )
0 commit comments