Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 1 commit into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 4 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
* [#93](https://github.com/clojure-emacs/inf-clojure/pull/93): Slow response from inf-clojure (completions, arglists, ...).
* [#101](https://github.com/clojure-emacs/inf-clojure/pull/101): `inf-clojure-set-ns` hangs Emacs.

### New Features

* [#114](https://github.com/clojure-emacs/inf-clojure/pull/114): Introduce `inf-clojure-project-type` defcustom.

## 2.0.1 (2017-05-18)

### Bugs Fixed
Expand Down
3 changes: 3 additions & 0 deletions 3 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ interacting with it.
`inf-clojure` has several custom variables which control the command
used to start a REPL for particular project type - `inf-clojure-lein-cmd`,
`inf-clojure-boot-cmd` and `inf-clojure-generic-cmd`.
The `inf-clojure-project-type` can force a particular project type, skipping
the project detection, which can be useful for projects that don't have
standard layouts.

By default all those variables are set to strings (e.g. `lein repl`).
However, it is possible to use a cons pair like `("localhost" . 5555)`
Expand Down
17 changes: 13 additions & 4 deletions 17 inf-clojure.el
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ number (e.g. (\"localhost\" . 5555))."
(stringp (car x))
(numberp (cdr x))))

(defcustom inf-clojure-project-type nil
"Defines the project type.

If this is `nil`, the project will be automatically detected."
:type 'string
:safe #'stringp
:package-version '(inf-clojure . "2.1.0"))

(defcustom inf-clojure-lein-cmd "lein repl"
"The command used to start a Clojure REPL for Leiningen projects.

Expand Down Expand Up @@ -511,10 +519,11 @@ Fallback to `default-directory.' if not within a project."

(defun inf-clojure-project-type ()
"Determine the type, either leiningen or boot of the current project."
(let ((default-directory (inf-clojure-project-root)))
(cond ((file-exists-p "project.clj") "lein")
((file-exists-p "build.boot") "boot")
(t nil))))
Copy link
Member

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.

(or inf-clojure-project-type
(let ((default-directory (inf-clojure-project-root)))
(cond ((file-exists-p "project.clj") "lein")
((file-exists-p "build.boot") "boot")
(t "generic")))))

(defun inf-clojure-cmd (project-type)
"Determine the command `inf-clojure' needs to invoke for the PROJECT-TYPE."
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.