Fork me on GitHub
#cider
<
2017-12-05
>
borkdude06:12:19

Hmm, all of a sudden I get:

borkdude06:12:19

[nREPL] Establishing direct connection to localhost:57718 ...
nrepl--direct-connect: [nREPL] Direct connection to localhost:57718 failed

borkdude07:12:50

Rebooted my system, threw away elpa, upgraded to cider-0.16.0-SNAPSHOT and it works again

ag22:12:47

can you guys remind me what should be the value of cider-lein-parameters for jack-in-clojurescript if the lein task is dev? I tried setting it to "dev" but I think it didn't work

dpsutton22:12:34

(defun my-jack-in-jib ()
  (interactive)
  (let ((cider-lein-global-options "with-profile dev"))
    (cider-jack-in-clojurescript)))

dpsutton22:12:50

that's how i start my project for work 🙂

ag22:12:20

what's the difference between cider-lein-parameters and cider-lein-global-options?

ag22:12:34

don't you have to set also cider-cljs-lein-repl?

ag22:12:38

@dpsutton this still doesn't work for me. It does create 2 repls, and in cljs one - I can see it's compiling cljs, but it doesn't automatically start the server

ag22:12:41

in order for it to work, in Clojure repl I also have to execute (go)

ag22:12:51

I want it to be executed automatically

ag22:12:24

the project uses integrant.repl

ag23:12:45

oh shoot..... I think I made it work:

ag23:12:50

(setq cider-cljs-lein-repl
      "(do (require 'figwheel-sidecar.repl-api)
           (require 'integrant.repl)
           (integrant.repl/go)
           (figwheel-sidecar.repl-api/start-figwheel!)
           (figwheel-sidecar.repl-api/cljs-repl))")

grzm23:12:34

Is there a happy medium between cider-eval-defun-to-comment and cider-eval-print-last-sexp ?

grzm23:12:13

I'd like to print just the last sexp with a comment prefix

grzm23:12:07

I've got this:

(defun cider-eval-last-sexp-to-comment ()
  "Evaluate the expression preceding point.
Print its value into the current buffer."
  (interactive)
  (let* ((bounds (cider-last-sexp 'bounds))
         (insertion-point (nth 1 bounds)))
    (cider-interactive-eval nil
                            (cider-eval-print-with-comment-handler
                             (current-buffer) insertion-point ";; => ")
                            (cider-last-sexp 'bounds))))

chrisblom16:12:08

the docstring of cider-last-sexp is not correct

chrisblom16:12:24

it works if you use a variant:

chrisblom16:12:39

(defun my/cider-last-sexp (&optional bounds)
  "Return the sexp preceding the point.
If BOUNDS is non-nil, return a list of its starting and ending position
instead."
  (apply (if bounds #'list #'buffer-substring-no-properties)
         (save-excursion
           (clojure-backward-logical-sexp 1)
           (list (point)
                 (progn (clojure-forward-logical-sexp 1)
                        (point))))))

(defun my/cider-eval-last-sexp-to-comment ()
  "Evaluate the expression preceding point.
Print its value into the current buffer."
  (interactive)
  (let* ((bounds (my/cider-last-sexp 'bounds))
         (insertion-point (nth 1 bounds)))
    (cider-interactive-eval nil
                            (cider-eval-print-with-comment-handler
                             (current-buffer) insertion-point ";; => ")
                            (cider-last-sexp 'bounds))))

grzm18:12:06

Thanks. I came up with a similar workaround by decrementing point. Yours is cleaner. Any idea why that change was made? The commit message lacks detail as to the motivation. https://github.com/clojure-emacs/cider/commit/f57abc71dbb2baf07687ac9c73025f31ee1a7c3e

grzm18:12:02

cider-eval-print-with-comment-handler has similar extra effects: that's where the newline is coming from.

grzm23:12:40

Which works with the minor issue that it prints on the next line, rather than after the expression. For example:

(solve-j)⬅︎ point was there
;; => 21841249