This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-19
Channels
- # aws (4)
- # aws-lambda (2)
- # beginners (67)
- # boot (38)
- # cider (32)
- # cljs-dev (12)
- # cljsrn (2)
- # clojars (2)
- # clojure (190)
- # clojure-chicago (1)
- # clojure-dusseldorf (2)
- # clojure-germany (1)
- # clojure-greece (3)
- # clojure-italy (5)
- # clojure-russia (6)
- # clojure-spec (47)
- # clojure-uk (10)
- # clojurescript (59)
- # cursive (9)
- # data-science (14)
- # datomic (24)
- # devops (16)
- # emacs (8)
- # fulcro (25)
- # graphql (30)
- # hoplon (123)
- # juxt (15)
- # lambdaisland (2)
- # leiningen (4)
- # luminus (6)
- # lumo (9)
- # off-topic (11)
- # om (7)
- # onyx (8)
- # re-frame (14)
- # reagent (5)
- # ring-swagger (5)
- # shadow-cljs (46)
- # spacemacs (41)
- # specter (8)
- # testing (8)
- # unrepl (31)
- # yada (18)
Anyone know why “M-.” & “M-,” does not work automagically (without manually evaluation of namespaces) when connecting to a app running within docker (with docker-compose)? I can get it working if I evaluate the namespace I want to “jump to”, but then if I reset (using Duct) I need to evaluate again. Does this ring a bell for anyone?
@benedek we’re using Duct but for some reason when we migrated to an docker-compose setup things stopped working properly.
there is some kind of reloaded repl in duct, right? does it start working if you reset
?
So docker-compose exposes at https://github.com/akvo/akvo-lumen/blob/develop/docker-compose.yml#L23
Then we run nrepl server at https://github.com/akvo/akvo-lumen/blob/develop/backend/project.clj#L78
Running Cider v 0.15.1-snapshot at the moment (but think I have tried with an older version to)
To answer your earlier question Duct uses reloaded.repl & we call reset from https://github.com/akvo/akvo-lumen/blob/develop/backend/dev/src/dev.clj#L16
@kardan I know why, it's because the paths are set to those inside the docker container
When you re-eval, you send a new filepath for the namespace, which means you can jump to it.
I think there might a way to handle this in emacs around re-writing paths, but that's beyond my knowledge, @benedek?
You can confirm this by looking at the (meta #'symbol)
before and after re-eval'ing the namespace
Given this function, defined in cider-interaction.el
(defun cider-eval-defun-to-comment (loc)
"Evaluate the \"top-level\" form and insert result as comment at LOC.
With a prefix arg, LOC, insert before the form, otherwise afterwards."
(interactive "P")
(let* ((bounds (cider-defun-at-point 'bounds))
(insertion-point (nth (if loc 0 1) bounds)))
(cider-interactive-eval nil
(cider-eval-print-with-comment-handler
(current-buffer) insertion-point ";; => ")
bounds)))
I can trivially make a variant that evals the last sexp, like so:
(defun cider-eval-last-sexp-to-comment (loc)
"Evaluate the \"top-level\" form and insert result as comment at LOC.
With a prefix arg, LOC, insert before the form, otherwise afterwards."
(interactive "P")
(let* ((bounds (cider-last-sexp 'bounds))
(insertion-point (nth (if loc 0 1) bounds)))
(cider-interactive-eval nil
(cider-eval-print-with-comment-handler
(current-buffer) insertion-point ";; => ")
bounds)))
where the only change is the let binding for “bounds”.
So then, why can’t I also pprint the output like this? If I try this function the output is lost in the void somewhere.
(defun cider-pprint-eval-last-sexp-to-comment (loc)
"Evaluate the \"top-level\" form and insert result as comment at LOC.
With a prefix arg, LOC, insert before the form, otherwise afterwards."
(interactive "P")
(let* ((bounds (cider-last-sexp 'bounds))
(insertion-point (nth (if loc 0 1) bounds)))
(cider-interactive-eval nil
(cider-eval-print-with-comment-handler
(current-buffer) insertion-point ";; => ")
bounds
(cider--nrepl-pprint-request-plist (cider--pretty-print-width)))))
I think this is because pprint typically directs to *out*
unless explicitly told otherwise. So the solution is going to involve setting a handler that takes care of that.