polylith

Casey 2025-03-10T10:11:39.925729Z

I often have multiple REPLs connected with cider to my emacs. In non-polylith projects using the https://docs.cider.mx/cider/usage/managing_connections.html#context-links works fine. But with polylith projects it seems cider resets its session choice itself every time it traverses a dir with deps.edn. The result is I am constantly having trouble evaling code into the correct REPL. Has anyone else experienced and perhaps worked around this?

2025-03-11T04:56:25.812659Z

i wrote this code for different purpose but might solve your particular issue.

(require 'clojure-mode)
  (defun locate-submissive-file (file name)
    (let ((it (locate-dominating-file file name)))
      (while-let ((maybe-descend-to-parent (and it (locate-dominating-file (file-name-parent-directory it) name))))
        (setq it maybe-descend-to-parent))
      it))


  (setq clojure-project-root-function
        (defun my/clojure-project-root-path (&optional dir-name)
          (or (locate-submissive-file (or dir-name default-directory) "deps.edn")
              (clojure-project-root-path dir-name))))

2025-03-11T04:57:19.201929Z

it just causes clojure projects to be identified by top-level deps.edn, 'submissive' instead of bottom-level 'dominant'