cider icon indicating copy to clipboard operation
cider copied to clipboard

cider-eval-last-sexp and all eval function will send buffer to all buffer if jack in both `clj` and `babashka`

Open idhowardgj94 opened this issue 2 months ago • 2 comments

Expected behavior

When I jack in both clj session and bb session, all clojure related code should send to clj session, and all bb session related code should send to bb session.

Actual behavior

sexp will send to both sessions, even if I try to use sesman-unlink and sesman-link-buffer

Steps to reproduce the problem

  1. cider-jack-in-clj, and select clojure-cli or tool that project use.
  2. cider-jack-in and select babashka
  3. go to babashka script file (.bb) file, and try to eval sexp. 4.. sexp will send to two session.

Environment & Version information

CIDER version information

Include here the version string displayed when CIDER's REPL is launched. Here's an example:

;; CIDER 1.20.0snapshot 
;;|openjdk 21.0.7 2025-04-15  

Lein / Clojure CLI version

Clojure CLI version 1.12.0.1530

Emacs version

E.g. 24.5 (use M-x emacs-version to check it if unsure)

Operating system

Pop!_OS 22.04 LTS

JDK distribution

openjdk 21.0.7 2025-04-15

idhowardgj94 avatar Oct 26 '25 06:10 idhowardgj94

when I inspect code, I notice that decide which session to send is defined by mode

(defun cider-repl-type-for-buffer (&optional buffer)                                                                                                                                          
  "Return the matching connection type (clj or cljs) for BUFFER.                                                                                                                              
BUFFER defaults to the `current-buffer'.  In cljc buffers return                                                                                                                              
multi.  This function infers connection type based on the major mode.                                                                                                                         
For the REPL type use the function `cider-repl-type'."                                                                                                                                        
  (with-current-buffer (or buffer (current-buffer))                                                                                                                                           
    (cond                                                                                                                                                                                     
     ((cider-clojurescript-major-mode-p) 'cljs)                                                                                                                                               
     ((cider-clojurec-major-mode-p) cider-clojurec-eval-destination)                                                                                                                          
     ((cider-clojure-major-mode-p) 'clj)                                                                                                                                                      
     (cider-repl-type))))     

and babashka's session seems to related to clj as well.

idhowardgj94 avatar Oct 26 '25 06:10 idhowardgj94

Could you check what cider-merge-sessions is set to? You can find it by M-x customize-group RET cider RET then search for Cider Merge Sessions and make sure it is not set. I got the eval in both REPLs only with that variable set to project. After unsetting it, eval is only to the last active REPL again.

onbreath avatar Nov 22 '25 12:11 onbreath