Fork me on GitHub
#editors
<
2015-08-12
>
sveri06:08:14

@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.

cfleming08:08:19

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

sveri10:08:58

@cfleming OK, thank you anyway

voxdolo14:08:20

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.

voxdolo14:08:09

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

malabarba14:08:52

@voxdolo: Use directory-local variables

malabarba14:08:11

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

voxdolo14:08:33

malabarba: sweet, thanks simple_smile

malabarba14:08:33

reply with clojure-mode

malabarba14:08:45

and then the variable, and then the value

voxdolo15:08:25

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

voxdolo15:08:00

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

voxdolo15:08:21

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

voxdolo15:08:49

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

malabarba15:08:44

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

malabarba15:08:56

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

malabarba15:08:27

Your dir-locals should end up looking like this:

malabarba15:08:41

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

malabarba15:08:25

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

voxdolo15:08:43

hmmm. that's not working for me.

voxdolo15:08:51

I have this now:

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

voxdolo15:08:27

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

malabarba15:08:26

Do db and log work now?

voxdolo15:08:37

malabarba: nope

voxdolo15:08:59

magic-require-namespaces in general have ceased to function

malabarba15:08:20

It's supposed to look like this I think

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

voxdolo15:08:22

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

voxdolo15:08:34

ah, okay, without the extra list?

malabarba15:08:37

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"))

malabarba15:08:51

Which is what you want

voxdolo15:08:15

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

malabarba15:08:31

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

malabarba15:08:36

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

malabarba15:08:03

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

voxdolo15:08:56

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?

voxdolo15:08:20

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

voxdolo15:08:30

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

voxdolo15:08:38

thanks for all the help malabarba simple_smile

malabarba15:08:03

Yes, that behavior is as intended.

malabarba15:08:18

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

voxdolo15:08:44

I'll look into the eval. Thanks again!

malabarba15:08:28

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

voxdolo15:08:10

ah! wonderful! Thanks so much 😄

voxdolo15:08:22

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.

malabarba15:08:35

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

malabarba15:08:09

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

voxdolo15:08:33

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

malabarba15:08:44

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

malabarba15:08:32

In a sense, Emacs is an interactive elisp machine

malabarba15:08:50

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