@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.
@sveri: I see - I’m not sure unfortunately. That sounds like useful functionality, for sure.
@cfleming OK, thank you anyway
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.
heh. I should google first, ask questions later: http://www.emacswiki.org/emacs/ProjectSettings
@voxdolo: Use directory-local variables
go to the root of your project and run M-x add-dir-local-variable
malabarba: sweet, thanks :simple_smile:
reply with clojure-mode
and then the variable, and then the value
np 😉
I think I must be doing something wrong. I've tried this:
((clojure-mode
(cljr-magic-require-namespaces quote
(("db" . "com.project.db")))))
or rather that's what my .dir-locals.el ended up looking like
but when in a clojure file in the project I type "db/" it doesn't auto-require the namespace
Ah, when you were asked for the value, you inserted '(("db" . "com.project.db"))
right?
I did
Insert (("db" . "com.project.db"))
instead, without the quote
Your dir-locals should end up looking like this:
`
((clojure-mode
(cljr-magic-require-namespaces
("db" . "com.project.db"))))
local values are never evaluated when read (both for dir-local and for file-local), so you don't need to quote them.
hmmm. that's not working for me.
I have this now:
((clojure-mode
(cljr-magic-require-namespaces (("db" . "com.project.db")
("log" . "com.project.internal.logging")))))
and it would seem that my other magic-requires in my .emacs.d have stopped working… maybe that's my issue.
Do db
and log
work now?
malabarba: nope
I though so
magic-require-namespaces in general have ceased to function
It's supposed to look like this I think
((clojure-mode
(cljr-magic-require-namespaces ("db" . "com.project.db")
("log" . "com.project.internal.logging"))))
there's probably something fundamental and silly that I'm missing. I'm still very new to elisp and emacs.
ah, okay, without the extra list?
yes
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"))
Which is what you want
okay, so it car
s for the thing to set and cdr
s for the value?
Another way to write that would be (cljr-magic-require-namespaces . (("db" . "com.project.db") ("log" . "com.project.internal.logging")))
Yes
To check if it worked, just visit a clojure file (that wasn't already opened), and do C-h v cljr-magic-require-namespaces
You should see a proper alist (a list where each element is a cons cell of two strings)
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?
do I need to concat
it with the values in my global settings?
eh, I guess I can just duplicate the ones from my global settings to the .dir-locals.el
…
thanks for all the help malabarba :simple_smile:
Yes, that behavior is as intended.
You can duplicate the values, or you can use an eval
I'll look into the eval. Thanks again!
((clojure-mode
(eval setq cljr-magic-require-namespaces
(append
'(("db" . "com.project.db")
("log" . "com.project.internal.logging"))
cljr-magic-require-namespaces))))
ah! wonderful! Thanks so much 😄
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.
To be fair, local-variables are a little bit tricky
But elisp is a full on language, and the best way to start is probably by reading
Just discovered M-x ielm
too, which should make banging at code like the above a little more interactive.
There's also just C-x C-e
, basically turns any buffer into ielm
In a sense, Emacs is an interactive elisp machine
Anything in any buffer is evaluatable with C-x C-e