Skip to content

Commit 8c27b06

Browse files
arichiardibbatsov
authored andcommitted
Introduce the tools.deps project type
The new inf-clojure-tools-deps-cmd will be used when the deps.edn file is going to be detected in the project root.
1 parent 5d76920 commit 8c27b06

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
### New Features
1313

1414
* [#114](https://github.com/clojure-emacs/inf-clojure/pull/114): Introduce `inf-clojure-project-type` defcustom.
15+
* [#117](https://github.com/clojure-emacs/inf-clojure/pull/117): Introduce `tools.deps` project type and `inf-clojure-tools-deps-cmd`.
1516

1617
## 2.0.1 (2017-05-18)
1718

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ Just invoke `M-x inf-clojure` or press `C-c C-z` within a Clojure source file.
7171
This will start a REPL process for the current project and you can start
7272
interacting with it.
7373

74-
`inf-clojure` has several custom variables which control the command
75-
used to start a REPL for particular project type - `inf-clojure-lein-cmd`,
76-
`inf-clojure-boot-cmd` and `inf-clojure-generic-cmd`.
77-
The `inf-clojure-project-type` can force a particular project type, skipping
78-
the project detection, which can be useful for projects that don't have
79-
standard layouts.
74+
`inf-clojure` has several custom variables which control the command used to
75+
start a REPL for particular project type - `inf-clojure-lein-cmd`,
76+
`inf-clojure-boot-cmd`, `inf-clojure-tools-deps-cmd` and
77+
`inf-clojure-generic-cmd`. The `inf-clojure-project-type` can force a
78+
particular project type, skipping the project detection, which can be useful
79+
for projects that don't have standard layouts.
8080

8181
By default all those variables are set to strings (e.g. `lein repl`).
8282
However, it is possible to use a cons pair like `("localhost" . 5555)`

inf-clojure.el

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,19 @@ often connecting to a remote REPL process."
225225
:safe #'inf-clojure--endpoint-p
226226
:package-version '(inf-clojure . "2.0.0"))
227227

228+
(defcustom inf-clojure-tools-deps-cmd "clj"
229+
"The command used to start a Clojure REPL for tools.deps projects.
230+
231+
Alternatively you can specify a TCP connection cons pair, instead
232+
of command, consisting of a host and port
233+
number (e.g. (\"localhost\" . 5555)). That's useful if you're
234+
often connecting to a remote REPL process."
235+
:type '(choice (string)
236+
(cons string integer))
237+
:risky #'stringp
238+
:safe #'inf-clojure--endpoint-p
239+
:package-version '(inf-clojure . "2.1.0"))
240+
228241
(defcustom inf-clojure-generic-cmd "lein repl"
229242
"The command used to start a Clojure REPL outside Lein/Boot projects.
230243
@@ -503,7 +516,7 @@ to continue it."
503516
(t str)))
504517

505518
(defvar inf-clojure-project-root-files
506-
'("project.clj" "build.boot")
519+
'("project.clj" "build.boot" "deps.edn")
507520
"A list of files that can be considered project markers.")
508521

509522
(defun inf-clojure-project-root ()
@@ -523,13 +536,15 @@ Fallback to `default-directory.' if not within a project."
523536
(let ((default-directory (inf-clojure-project-root)))
524537
(cond ((file-exists-p "project.clj") "lein")
525538
((file-exists-p "build.boot") "boot")
539+
((file-exists-p "deps.edn") "tools.deps")
526540
(t "generic")))))
527541

528542
(defun inf-clojure-cmd (project-type)
529543
"Determine the command `inf-clojure' needs to invoke for the PROJECT-TYPE."
530544
(pcase project-type
531545
("lein" inf-clojure-lein-cmd)
532546
("boot" inf-clojure-boot-cmd)
547+
("tools.deps" inf-clojure-tools-deps-cmd)
533548
(_ inf-clojure-generic-cmd)))
534549

535550
(defun inf-clojure-clear-repl-buffer ()

0 commit comments

Comments
 (0)