-
-
Notifications
You must be signed in to change notification settings - Fork 247
[Fix #451] respect project root dir suggested by custom function #452
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
Changes from 2 commits
beed375
5ffb46c
3e58acd
766fc5b
cd71981
607a2ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,11 @@ Out-of-the box `clojure-mode' understands lein, boot and gradle." | |
(and (listp value) | ||
(cl-every 'stringp value)))) | ||
|
||
(defcustom clojure-project-root-locating-function nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The defcustom should also have a |
||
"Alternative function to locate clojure project root directory, eg. projectile-project-root" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why alternative - let's just set it by default to the currently existing function. |
||
:type 'symbol | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there's a type: 'function |
||
:safe 'symbolp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This variable is funcalled, so no value is safe for it. In fact, we should probably mark it as risky. |
||
|
||
(defcustom clojure-refactor-map-prefix (kbd "C-c C-r") | ||
"Clojure refactor keymap prefix." | ||
:type 'string | ||
|
@@ -1607,8 +1612,12 @@ Return nil if not inside a project." | |
(mapcar (lambda (fname) | ||
(locate-dominating-file dir-name fname)) | ||
clojure-build-tool-files)))) | ||
(when (> (length choices) 0) | ||
(car (sort choices #'file-in-directory-p))))) | ||
(or (and (fboundp clojure-project-root-locating-function) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd simply remove those check here - if the user set something explicitly we can assume they know what they are doing. Fallbacks are pointless and confusing here. |
||
(condition-case err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just ignore-errors |
||
(funcall clojure-project-root-locating-function) | ||
(error nil))) | ||
(when (> (length choices) 0) | ||
(car (sort choices #'file-in-directory-p)))))) | ||
|
||
(defun clojure-project-relative-path (path) | ||
"Denormalize PATH by making it relative to the project root." | ||
|
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.
I'd name this just
clojure-project-root-function
.