This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-27
Channels
- # babashka (39)
- # beginners (256)
- # calva (33)
- # cider (4)
- # clj-otel (8)
- # clojure (48)
- # clojure-denmark (3)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (45)
- # clojure-poland (1)
- # clojure-sweden (2)
- # clojure-uk (5)
- # clojuredesign-podcast (5)
- # clr (13)
- # core-async (9)
- # cursive (12)
- # data-science (2)
- # datahike (80)
- # datomic (5)
- # hyperfiddle (14)
- # introduce-yourself (4)
- # jobs (4)
- # lsp (7)
- # missionary (6)
- # polylith (25)
- # proletarian (5)
- # releases (1)
- # shadow-cljs (12)
- # squint (7)
- # xtdb (2)
Slightly weird one - I'm using C-c C-k
, which is bound to the default cider-load-buffer
, but I'm cider-connect
ed to a repl that doesn't have access to my local filesystem, so I'm getting an error like:
------ REPL Error while processing ---------------------------------------------
(cljs.core/load-file "/home/harold/src/stuff/otherstuff/filename.cljs")
FileNotFoundException: /home/harold/src/stuff/otherstuff/filename.cljs (No such file or directory)
Is there a way to just send the buffer contents (maybe, as a string) rather than loading the file?
e.g., C-M-x
successfully evaluates the ns
form at the top of the file.
---
Or (maybe even cooler) is there a way to have it use relative rather than absolute paths? Because (due to some clever mounting) the repl does have the updated code locally at the same relative (but different absolute) path.I think what you are looking for is cider-path-translations
defcustom variable See https://docs.cider.mx/cider/config/basic_config.html#translate-file-paths
We use exactly that, as we cider-connect
to a REPL running inside a Docker container (for various reasons) and we mount the local files inside the Docker container using a different absolute path. You can even set the value per project, by leveraging .dirs-local.el
. We have something like this at the root of the (local) project
((clojure-mode . ((eval . (setq-local cider-path-translations (list (cons "/app" (clojure-project-dir (buffer-file-name (current-buffer))))))))))
where /app
is where we mount the project files inside the Docker container.