71
71
(defvar psci/prompt " > "
72
72
" The psci prompt." )
73
73
74
- (defvar psci/project-module-file " .psci"
75
- " The default file referencing the purescript modules to load at psci startup." )
76
-
77
- (defvar psci/--modules-folder " .psci_modules"
78
- " The modules folder psci uses as cache." )
79
-
80
74
; ; private functions
81
75
82
76
(defun psci/log (msg )
@@ -102,28 +96,6 @@ When FILENAME is nil or not a real file, returns nil."
102
96
(insert-file-contents filename)
103
97
(buffer-substring-no-properties (point-min ) (point-max )))))
104
98
105
- (defun psci/--project-psci-file (project-root-folder )
106
- " Compute the project's psci file from the PROJECT-ROOT-FOLDER.
107
- Returns nil if no .psci file is found."
108
- (let ((psci-module-file (expand-file-name psci/project-module-file project-root-folder)))
109
- (when (file-exists-p psci-module-file)
110
- psci-module-file)))
111
-
112
- (defun psci/--project-module-files! ()
113
- " Compulse the list of modules for the current project.
114
- Assumes the location of the modules is the project root folder."
115
- (let* ((parent-root-folder (psci/--project-root!))
116
- (psci-module-file (psci/--project-psci-file parent-root-folder)))
117
- (when psci-module-file
118
- (->> psci-module-file
119
- psci/--file-content
120
- (s-split " \n " )
121
- nreverse ))))
122
-
123
- (defun psci/--compute-modules-folder (project-root-folder )
124
- " Compute the psci modules folder from PROJECT-ROOT-FOLDER."
125
- (concat project-root-folder psci/--modules-folder))
126
-
127
99
(defun psci/--run-psci-command! (command )
128
100
" Run psci COMMAND as string."
129
101
(-when-let (process (get-buffer-process (psci/--process-name psci/buffer-name)))
@@ -203,20 +175,6 @@ Relies on .psci file for determining the project's root folder."
203
175
(-when-let (module-name (psci/--compute-module-name!))
204
176
(psci/--run-psci-command! (format " import %s " module-name))))
205
177
206
- ;;;### autoload
207
- (defun psci/load-project-modules! ()
208
- " Load the modules needed for the repl session.
209
- We chose to load the .psci file's content (the purescript doc proposes its use)."
210
- (interactive )
211
- (lexical-let ((archive-folder (psci/--compute-modules-folder (psci/--project-root!))))
212
- (deferred:$
213
- (deferred:process-shell " rm -rf " (shell-quote-argument (format " %s /node_modules/*" archive-folder))) ; ; clean compiled version
214
- (deferred:nextc it (lambda () (call-interactively 'psci/reset! ))) ; ; flush in-memory version
215
- (deferred:nextc it ; ; at last reload all files
216
- (lambda ()
217
- (-when-let (commands (psci/--project-module-files!))
218
- (mapc #'psci/--run-psci-command! commands)))))))
219
-
220
178
;;;### autoload
221
179
(defun psci/reset! ()
222
180
" Reset the current status of the repl session."
@@ -232,14 +190,13 @@ We chose to load the .psci file's content (the purescript doc proposes its use).
232
190
(defvar inferior-psci-mode-map
233
191
(let ((map (make-sparse-keymap )))
234
192
(define-key map (kbd " C-c C-l" ) 'psci/load-current-file! )
235
- (define-key map (kbd " C-c C-r" ) 'psci/load-project-modules! )
236
193
(define-key map (kbd " C-c M-n" ) 'psci/load-module! )
237
194
map)
238
195
" Basic mode map for `inferior-psci-mode' ." )
239
196
240
197
(defgroup psci nil " psci customisation group."
241
198
:tag " psci"
242
- :version " 0.0.4 "
199
+ :version " 0.0.9 "
243
200
:group 'purescript
244
201
:prefix " psci/" )
245
202
0 commit comments