-
-
Notifications
You must be signed in to change notification settings - Fork 44
Introduce inf-clojure-project-type defcustom #114
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
Conversation
Frankly, I don't understand what exactly is the point of doing this change. You can always override the lein/boot command for a specific project, so if something is lein/boot and you need a different command to be used the option is always there for you. If it's not - you end up using the generic command anyways. |
I know very well that trick, using it all the time. However the scenario here is different: in lumo projects you don't need to have a So all of a sudden you introduce the file (say This back and forth happens in many scenarios (one other weird one is when you generate a project with My rationale on this is that when I am in a |
I think what you really want to do is not to skip project detection but to be able to specify a generic project type via |
I am fine with that too, it still involves adding one more line in |
Hello again @bbatsov, I have checked the code but it seems that there is no What would you suggest me to do here? Add one for project type? Then we'd need also a more flexible one for the command..(handle any possible commands for any possible project type?). Seems like a bigger change. |
So to explain the problem better, in my folder I have both
|
This just had to be checked by the |
Got it, so you would prefer to create a What would the project type use as At the moment we have three |
I see in
|
Maybe our detection can interact with Fairly complicated I know, I still like my small hack better. |
A Seems to me that this solves your problem completely.
We can always add some integration with projectile as well - that'd be pretty simple. But this should be something optional, as we don't want to force Projectile on everyone. |
Isn't a defvar that overrides the logic exactly what I am doing? Maybe I don't understand your solution here. |
The |
Yeah, but you're making something very specific (you can just make something generic) and it should be able to force whatever project type you want to. That's what started all of my comments. I don't like very specific options, normally I'd make something as generic as possible. |
inf-clojure.el
Outdated
@@ -189,6 +189,15 @@ number (e.g. (\"localhost\" . 5555))." | ||
(stringp (car x)) | ||
(numberp (cdr x)))) | ||
|
||
(defcustom inf-clojure-skip-project-detection nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically this should be inf-clojure-project-type
and the docstring should say it's purpose is to override the default project type resolution via .dir_locals.el
.
(let ((default-directory (inf-clojure-project-root))) | ||
(cond ((file-exists-p "project.clj") "lein") | ||
((file-exists-p "build.boot") "boot") | ||
(t nil)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be returning "generic"
if the project type can't be determined, so we can leverage the defcustom
- if it's nil it does nothing, otherwise it takes precedence over this.
I've explained in the code exactly what I mean. Hopefully now you understand me. |
Thanks should be clear now, will change this patch. |
417bc9d
to
abd4373
Compare
abd4373
to
14f738a
Compare
@bbatsov done, can you review please. I want to be sure I got it right. |
inf-clojure.el
Outdated
(cond ((file-exists-p "project.clj") "lein") | ||
((file-exists-p "build.boot") "boot") | ||
(t nil)))) | ||
(when (null inf-clojure-project-type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use or
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No wait, the code should run if this is nil
. So basically something else than nil
will not trigger the detection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's what or
will do - (or type (detect-type))
. That seems pretty clear to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I was confused for a moment 😄
This patch adds a defcustom, inf-clojure-project-type, so that when it is not-nil we skip the project detection and choose which inf-clojure-*-cmd will be used. This is very useful for projects that don't have standard layouts.
14f738a
to
8fbfff8
Compare
This patch adds a defcustom, inf-clojure-skip-project-detection, that when
non-nil skips the project detection so that only inf-clojure-generic-cmd will
be used. This is very useful for projects that don't have standard layouts.
M-x checkdoc
warnings