Skip to content

Commit 9793072

Browse files
committed
- [X] Remove projectile dependencies and compute the root folder using emacs primitives (thanks @purcell again)
1 parent 64d911f commit 9793072

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

psci.el

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
;; Author: Antoine R. Dumont <eniotna.t AT gmail.com>
66
;; Maintainer: Antoine R. Dumont <eniotna.t AT gmail.com>
77
;; Version: 0.0.4
8-
;; Package-Requires: ((purescript-mode "13.10") (dash "2.9.0") (projectile "0.11.0") (s "1.9.0") (f "0.17.1") (deferred "0.3.2"))
8+
;; Package-Requires: ((purescript-mode "13.10") (dash "2.9.0") (s "1.9.0") (f "0.17.1") (deferred "0.3.2"))
99
;; Keywords: purescript psci repl major mode
1010
;; URL: https://github.com/ardumont/emacs-psci
1111

@@ -43,7 +43,6 @@
4343
(require 'comint)
4444
(require 'dash)
4545
(require 'purescript-mode)
46-
(require 'projectile)
4746
(require 's)
4847
(require 'f)
4948
(require 'deferred)
@@ -92,7 +91,7 @@
9291
(current-buffer)))
9392
;; create the comint process if there is no buffer.
9493
(unless buffer
95-
(setq-local default-directory (projectile-project-root))
94+
(set (make-local-variable 'default-directory) (psci/--project-root!))
9695
(apply 'make-comint-in-buffer psci/buffer-name buffer
9796
psci-program psci/arguments)
9897
(psci-mode))))
@@ -137,7 +136,7 @@
137136
(defun psci/load-current-file! ()
138137
"Load the current file in the psci repl."
139138
(interactive)
140-
(lexical-let ((archive-folder (psci/--compute-modules-folder (projectile-project-root)))
139+
(lexical-let ((archive-folder (psci/--compute-modules-folder (psci/--project-root!)))
141140
(module-name (psci/--compute-module-name!)))
142141
(when module-name
143142
(deferred:$
@@ -188,7 +187,7 @@ Returns nil if no .psci file is found."
188187
(defun psci/--project-module-files! ()
189188
"Compulse the list of modules for the current project.
190189
Assumes the location of the modules is the project root folder."
191-
(let* ((parent-root-folder (projectile-project-root))
190+
(let* ((parent-root-folder (psci/--project-root!))
192191
(psci-module-file (psci/--project-psci-file parent-root-folder)))
193192
(when psci-module-file
194193
(->> psci-module-file
@@ -210,7 +209,7 @@ Assumes the location of the modules is the project root folder."
210209
"Load the modules needed for the repl session.
211210
We chose to load the .psci file's content (the purescript doc proposes its use)."
212211
(interactive)
213-
(lexical-let ((archive-folder (psci/--compute-modules-folder (projectile-project-root))))
212+
(lexical-let ((archive-folder (psci/--compute-modules-folder (psci/--project-root!))))
214213
(deferred:$
215214
(deferred:process-shell "rm -rf " (shell-quote-argument (format "%s/node_modules/*" archive-folder))) ;; clean compiled version
216215
(deferred:nextc it (lambda () (call-interactively 'psci/reset!))) ;; flush in-memory version
@@ -225,6 +224,12 @@ We chose to load the .psci file's content (the purescript doc proposes its use).
225224
(interactive)
226225
(psci/--run-psci-command! ":r"))
227226

227+
(defun psci/--project-root! ()
228+
"Determine the project's root folder."
229+
(->> psci/project-module-file
230+
(locate-dominating-file default-directory)
231+
expand-file-name))
232+
228233
;; Add some default bindings
229234
(add-hook 'purescript-mode-hook (lambda ()
230235
(define-key purescript-mode-map (kbd "C-c C-l") 'psci/load-current-file!)

todo.org

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ CLOSED: [2014-10-29 Wed 18:54]
2727
- [X] Add to el-get - https://github.com/ardumont/el-get/blob/add-psci-recipe/recipes/psci.rcp
2828
- [X] Update documentation regarding installation steps
2929
- [X] Update documentation regarding usage
30-
* IN-PROGRESS 0.0.4 [57%]
30+
* IN-PROGRESS 0.0.4 [62%]
3131
- [X] Update version
3232
- [X] Add an interactive command for displaying the current version
3333
- [X] Use compatible with old emacs version api (replace `(setq-local var val)` with `(set (make-local-variable 'var) val)`)
3434
- [X] `shell-quote-argument` around shell code
35-
- [ ] Remove projectile dependencies and compute the root folder using emacs primitives (thanks @purcell again)
35+
- [X] Remove projectile dependencies and compute the root folder using emacs primitives (thanks @purcell again)
36+
- [ ] Update el-get PR to remove projectile dependencies
3637
- [ ] Add a minor mode instead of modifying purescript-mode-map
3738
- [ ] Update documentation about the minor-mode activation

0 commit comments

Comments
 (0)