Fork me on GitHub
#cider
<
2019-10-23
>
Martin06:10:15

I can't seem to get cider to pass my arguments to clj:

Martin06:10:25

(use-package cider
      :ensure t
      :after (clojure-mode)
      :init
      (setq cider-clojure-cli-global-options "-A:dev")
      :config
      (setq cider-clojure-cli-global-options "-A:dev")
      (setq nrepl-log-messages t)
      (add-hook 'cider-mode-hook #'eldoc-mode)
      (add-hook 'cider-repl-mode-hook #'eldoc-mode)
      (add-hook 'cider-repl-mode-hook #'paredit-mode)
      (add-hook 'cider-repl-mode-hook #'rainbow-delimiters-mode))

Martin06:10:21

[nREPL] Starting server via /usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/cider-nrepl {:mvn/version "0.22.3"}}}' -m nrepl.cmdline --middleware '["cider.nrepl/cider-middleware"]'

Martin06:10:45

how can I debug this?

bozhidar07:10:44

Did you restart Emacs/reload your config after making those changes?

mgrbyte09:10:44

Yes; i use two other packages that depend on cider (`helm-cider` and flycheck-clojure) - so did a package-del -> eval pinning code -> package-ins -> restart dance before testing anew.

mgrbyte09:10:53

I figured it out, but not sure how to fix (fix running tests in cider I mean). I'm using clojure CLI tools. Tests work with that from the command line however, which made me realise that the only thing I've changed that I think that could cause this within cider is that I moved the inclusion of webasets (resources subfolder) into an alias (to support depstar's way of uberjar-ing)... which probably means that I need to figure out how cider runs tests under clj. I have some code that reads configuration from the resources folder which is causing the NPE.

mgrbyte09:10:57

I guess there's a few options: 1. Put the "resources" folder back into :paths in deps.edn, move the webassets elsewhere. Means tests can't hit any code path that hits the static resources route in the webapp tho. 2. Move the reading of configuration into a fn (instead of a module-level def) such that the exception doesn't ocur when attempting to load the namespaces/files.

Martin14:10:49

@U051BLM8F yes I’ve restarted emacs everytime I’m making changes

ag06:10:19

Can we add something like this to cljr-clean-ns

(defun cljr-ns-align ()
  "Align ns requires."
  (interactive)
  (end-of-buffer)
  (when (re-search-backward "^\(ns.*\\(\n.*\\)*\(:require" nil t nil)
    (mark-sexp)
    (align-regexp (region-beginning)
                  (region-end)
                  "\\(\\s-*\\)\\s-:")))
My team recently decided to start aligning requires and I think we like that. It probably should be done maybe via middleware, but I don’t know where the relevant code is.

yuhan09:10:01

looks like it's a text formatting matter and shouldn't involve the middleware at all?

bozhidar09:10:57

Generally all sort of formatting functions that don’t require middleware or external deps should end up in clojure-mode. We’ve actually been moving out things from clj-refactor in recent years, but at a rather slow pace due to our limited time.

ag16:10:30

> looks like it’s a text formatting matter and shouldn’t involve the middleware at all? Well, I was looking at cljr-clean-ns and it seems using middleware. Also maybe it should be possible to have similar functionality not just in Emacs.