-
-
Notifications
You must be signed in to change notification settings - Fork 247
Custom source path #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom source path #152
Conversation
It's possible to configure source and test inner directories to add support for hierarchy like 'src/clojure' and 'test/clojure'. Currently only works on inserting and updating ns.
I think there are no more issues with custom source/test directories. Time will tell :)
Hope it's ok :)
I too have needed this functionality. However, I can't help but think that maybe there's an easier way to do it. Would there be a way to get the ns management code to detect this automatically? That might be better for working with multiple clojure projects simultaneously. I think at least for the jump functions it seems possible. |
While I certainly don't object to having this automated, I couldn't think of a way to do it (actually I think my solution is far from elegant but I'm waiting for some indication that it's interesting to the maintainers before I invest more time in learning elisp). In the meantime If you need to work on multiple projects (I do) just use ((clojure-mode
(clojure-source-nested-directory . "/clojure"))
(nil
(ffip-find-options . "-not -regex \".*node_modules.*\" -not -regex \".*target.*\" -not -regex \".*vendor.*\" -not -regex \".*resources/public/js/.*\""))) Bye |
I'm a maintainer. :) |
clojure-mode is a clown car of maintainers |
haha |
aha :) In this case I'll start looking for a nicer solution. Any pointers? Thanks. |
I was just thinking that once you find the dominating file you have a left bracket, and you know that the right bracket is going to be the directories and file name derived from the namespace, so there should be a way to get that middle chunk. So for example, if you have " What do you think about this? |
Well, for jumping between tests and implementation you're right. However, I constantly use the |
Thanks for the contribution. I've tested out the code and I think it's good the way it is. I'm noodling over the name. Glad to hear any opinions. |
Thanks. Before you accept it I want to change one thing. Currently its required to add "/" to the beginning of As for the naming I'm terrible with names and on top of that, english is not my mother's tongue so please change the names to whatever you think it's appropriate. Thanks |
Following advice from #emacs irc, I created a function with the same name as the custom for accessing the normalized version of the clojure-source-nested-directory value.
Hi I've added 2 changes:
Should I add some documentation for it in Thanks |
Yes, please add some documentation to the README. Thanks! |
Hi I've added documentation. Please take a look at it and fix if required :) Thanks. |
Hi, This is great! Thanks. I had a similar issue but solved it by using eproject. You can easily configure eprojects to overwrite, e.g. (require 'clojure-mode)
(require 'eproject)
(define-project-type clojure (generic)
(look-for ".clojure")
:irrelevant-files ("target/" ".*" "lib/"))
(add-hook 'clojure-project-file-visit-hook
(lambda ()
(setq clojure-test-implementation-for-fn 'clojure-test-implementation-for-mvn)
(setq clojure-test-for-fn 'clojure-test-for-mvn))) You might want to change Cheers |
Sorry about this, but I've come to the conclusion that this functionality is better provided in a separate mode that can focus on doing one thing well rather than being bundled in clojure-mode; please see the discussion at #196. |
Added support for custom source path under the
src
andtest
directory. It fixes inserting/updating the namespace and switching between test and implementation if the project has a different source layout (e.g. sources insrc/clojure
and tests intest/clojure
).I'm a complete noob with elisp and this is only a first draft. Here are some thoughts I have:
clojure-source-nested-directory
- need a better name (maybeclojure-path-inner-directory
?) :(clojure-source-nested-directory
be defined with defvar instead of with defcustom? I don't think there's much use for it in the customization window. It's mainly for.dir-locals.el
.I will happily invest more time in it if required. I need the functionality and I'll be happy to learn elisp :)
Regards
Haim