Skip to content

Commit 9bb6a32

Browse files
authored
Merge pull request #31 from Gavinok/project-el-support
Add project.el support as an alternative to projectile
2 parents 95fb5d1 + 309ebeb commit 9bb6a32

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

README.org

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ M-x el-get-install RET psci RET
121121
M-x psci
122122
#+end_src
123123

124-
This will open a psci repl within emacs from your current project root folder (using [[https://github.com/bbatsov/projectile][projectile]] to determine that).
124+
This will open a psci repl within emacs from your current project root folder (using [[https://github.com/bbatsov/projectile][projectile]] or project.el to determine that).
125125

126126
** Setup
127127

psci.el

+10-5
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@
8585
(defun psci--project-root! ()
8686
"Determine the project's root folder.
8787
Beware, can return nil if no .psci file is found."
88-
(if (and (fboundp 'projectile-project-root) (projectile-project-p))
89-
(projectile-project-root)
90-
default-directory))
88+
(cond
89+
((and (fboundp 'projectile-project-root) (projectile-project-p))
90+
(projectile-project-root))
91+
((fboundp 'project-root)
92+
(project-root (project-current t)))
93+
(t
94+
default-directory)))
9195

9296
(defun psci--process-name (buffer-name)
9397
"Compute the buffer's process name based on BUFFER-NAME."
@@ -136,8 +140,9 @@ Otherwise, just return PATH."
136140
(defun psci (project-root-folder)
137141
"Run an inferior instance of \"psci\" inside Emacs, in PROJECT-ROOT-FOLDER.
138142
If not supplied, the root folder will be guessed using
139-
`projectile-project-root' (if available), otherwise it will
140-
default to the current buffer's directory."
143+
`projectile-project-root', or `project-root' from project.el (if
144+
available), otherwise it will default to the current buffer's
145+
directory."
141146
(interactive (list (read-directory-name "Project root: "
142147
(psci--project-root!))))
143148
(let* ((default-directory project-root-folder)

0 commit comments

Comments
 (0)