editors

Discussion about all editors used for Clojure/ClojureScript
sveri 2015-08-12T06:01:14.000284Z

@cfleming: I am running my clojure tests with the "test-out" plugin, which generates junit results. In eclipse I can drag the file into the test results view and it will be parsed and displayed, which is quite handy for stuff like that. I wonder if there is a similar feature for intellij.

cfleming 2015-08-12T08:28:19.000285Z

@sveri: I see - I’m not sure unfortunately. That sounds like useful functionality, for sure.

sveri 2015-08-12T10:18:58.000286Z

@cfleming OK, thank you anyway

voxdolo 2015-08-12T14:54:20.000287Z

Is it possible in emacs to have project-specific configurations? I'd love to be able to check some project-specific clj-refactor magic requires into that project's repo.

voxdolo 2015-08-12T14:55:09.000288Z

heh. I should google first, ask questions later: http://www.emacswiki.org/emacs/ProjectSettings

malabarba 2015-08-12T14:55:52.000289Z

@voxdolo: Use directory-local variables

malabarba 2015-08-12T14:56:11.000290Z

go to the root of your project and run M-x add-dir-local-variable

voxdolo 2015-08-12T14:56:33.000291Z

malabarba: sweet, thanks :simple_smile:

malabarba 2015-08-12T14:56:33.000292Z

reply with clojure-mode

malabarba 2015-08-12T14:56:45.000293Z

and then the variable, and then the value

malabarba 2015-08-12T14:56:49.000294Z

np 😉

voxdolo 2015-08-12T15:07:25.000295Z

I think I must be doing something wrong. I've tried this:

voxdolo 2015-08-12T15:08:00.000298Z

((clojure-mode
  (cljr-magic-require-namespaces quote
                                 (("db" . "com.project.db")))))

voxdolo 2015-08-12T15:08:21.000299Z

or rather that's what my .dir-locals.el ended up looking like

voxdolo 2015-08-12T15:08:49.000300Z

but when in a clojure file in the project I type "db/" it doesn't auto-require the namespace

malabarba 2015-08-12T15:09:44.000301Z

Ah, when you were asked for the value, you inserted '(("db" . "com.project.db")) right?

voxdolo 2015-08-12T15:09:53.000302Z

I did

malabarba 2015-08-12T15:09:56.000303Z

Insert (("db" . "com.project.db")) instead, without the quote

malabarba 2015-08-12T15:10:27.000304Z

Your dir-locals should end up looking like this:

malabarba 2015-08-12T15:10:31.000305Z

`

malabarba 2015-08-12T15:10:41.000306Z

((clojure-mode
  (cljr-magic-require-namespaces
   ("db" . "com.project.db"))))

malabarba 2015-08-12T15:11:25.000307Z

local values are never evaluated when read (both for dir-local and for file-local), so you don't need to quote them.

voxdolo 2015-08-12T15:14:43.000308Z

hmmm. that's not working for me.

voxdolo 2015-08-12T15:15:51.000309Z

I have this now:

((clojure-mode
  (cljr-magic-require-namespaces (("db" . "com.project.db")
                                  ("log" . "com.project.internal.logging")))))

voxdolo 2015-08-12T15:16:27.000310Z

and it would seem that my other magic-requires in my .emacs.d have stopped working… maybe that's my issue.

malabarba 2015-08-12T15:18:26.000311Z

Do db and log work now?

voxdolo 2015-08-12T15:18:37.000312Z

malabarba: nope

malabarba 2015-08-12T15:18:48.000313Z

I though so

voxdolo 2015-08-12T15:18:59.000314Z

magic-require-namespaces in general have ceased to function

malabarba 2015-08-12T15:19:20.000315Z

It's supposed to look like this I think

((clojure-mode
  (cljr-magic-require-namespaces ("db" . "com.project.db")
                                  ("log" . "com.project.internal.logging"))))

voxdolo 2015-08-12T15:19:22.000316Z

there's probably something fundamental and silly that I'm missing. I'm still very new to elisp and emacs.

voxdolo 2015-08-12T15:19:34.000317Z

ah, okay, without the extra list?

malabarba 2015-08-12T15:19:45.000318Z

yes

malabarba 2015-08-12T15:20:37.000319Z

Basically, the cdr of that thing is the value that will be set. And the cdr of (cljr-magic-require-namespaces ("db" . "com.project.db") ("log" . "com.project.internal.logging")) is (("db" . "com.project.db") ("log" . "com.project.internal.logging"))

malabarba 2015-08-12T15:20:51.000320Z

Which is what you want

voxdolo 2015-08-12T15:21:15.000321Z

okay, so it cars for the thing to set and cdrs for the value?

malabarba 2015-08-12T15:21:31.000322Z

Another way to write that would be (cljr-magic-require-namespaces . (("db" . "com.project.db") ("log" . "com.project.internal.logging")))

malabarba 2015-08-12T15:21:33.000323Z

Yes

malabarba 2015-08-12T15:22:36.000324Z

To check if it worked, just visit a clojure file (that wasn't already opened), and do C-h v cljr-magic-require-namespaces

malabarba 2015-08-12T15:23:03.000325Z

You should see a proper alist (a list where each element is a cons cell of two strings)

voxdolo 2015-08-12T15:23:56.000326Z

Okay, I do see that. It's saying that it's overriding my global value as set in my .emacs.d… is there any way to fix that?

voxdolo 2015-08-12T15:24:20.000327Z

do I need to concat it with the values in my global settings?

voxdolo 2015-08-12T15:26:30.000328Z

eh, I guess I can just duplicate the ones from my global settings to the .dir-locals.el

voxdolo 2015-08-12T15:26:38.000329Z

thanks for all the help malabarba :simple_smile:

malabarba 2015-08-12T15:29:03.000330Z

Yes, that behavior is as intended.

malabarba 2015-08-12T15:29:18.000331Z

You can duplicate the values, or you can use an eval

voxdolo 2015-08-12T15:29:44.000332Z

I'll look into the eval. Thanks again!

malabarba 2015-08-12T15:30:28.000333Z

((clojure-mode
  (eval setq cljr-magic-require-namespaces
        (append
         '(("db" . "com.project.db")
           ("log" . "com.project.internal.logging"))
         cljr-magic-require-namespaces))))

voxdolo 2015-08-12T15:31:10.000334Z

ah! wonderful! Thanks so much 😄

voxdolo 2015-08-12T15:32:22.000335Z

I really need to step back and get my fundamentals right with elisp. I keep trying to hack at it when I have to and tend to treat it more like a configuration language than a proper lisp.

malabarba 2015-08-12T15:33:35.000336Z

To be fair, local-variables are a little bit tricky

malabarba 2015-08-12T15:34:09.000337Z

But elisp is a full on language, and the best way to start is probably by reading

voxdolo 2015-08-12T15:35:33.000338Z

Just discovered M-x ielm too, which should make banging at code like the above a little more interactive.

malabarba 2015-08-12T15:37:44.000339Z

There's also just C-x C-e, basically turns any buffer into ielm

malabarba 2015-08-12T15:38:32.000340Z

In a sense, Emacs is an interactive elisp machine

malabarba 2015-08-12T15:38:50.000341Z

Anything in any buffer is evaluatable with C-x C-e