83
83
84
84
; ; private functions
85
85
86
- (defun psci/ --project-root! ()
86
+ (defun psci--project-root! ()
87
87
" Determine the project's root folder.
88
88
Beware, can return nil if no .psci file is found."
89
89
(if (and (fboundp 'projectile-project-root ) (projectile-project-p))
90
90
(projectile-project-root)
91
91
default-directory))
92
92
93
- (defun psci/ --process-name (buffer-name )
93
+ (defun psci--process-name (buffer-name )
94
94
" Compute the buffer's process name based on BUFFER-NAME."
95
95
(format " *%s * " buffer-name))
96
96
97
- (defun psci/ --file-content (filename )
97
+ (defun psci--file-content (filename )
98
98
" Load FILENAME's content as a string.
99
99
When FILENAME is nil or not a real file, returns nil."
100
100
(when (and filename (file-exists-p filename))
101
101
(with-temp-buffer
102
102
(insert-file-contents filename)
103
103
(buffer-substring-no-properties (point-min ) (point-max )))))
104
104
105
- (defun psci/ --run-psci-command! (command )
105
+ (defun psci--run-psci-command! (command )
106
106
" Run psci COMMAND as string."
107
- (-when-let (process (get-buffer-process (psci/ --process-name psci/buffer-name)))
107
+ (-when-let (process (get-buffer-process (psci--process-name psci/buffer-name)))
108
108
(comint-simple-send process command)))
109
109
110
- (defun psci/ --compute-module-name! ()
110
+ (defun psci--compute-module-name! ()
111
111
" Compute the current file's module name."
112
112
(save-excursion
113
113
(goto-char (point-min ))
114
114
(let ((regexp " ^module\\ s-+\\ \( [a-zA-Z0-9\\ \. ]+\\ \) \\ b" ))
115
115
(search-forward-regexp regexp)
116
116
(match-string 1 ))))
117
117
118
- (defun psci/ --get-psc-package-sources! ()
118
+ (defun psci--get-psc-package-sources! ()
119
119
" Find extra source path globs using purescript package tools,if they appear to be used."
120
120
(cond
121
121
((file-exists-p " psc-package.json" )
122
- (process-lines (psci/ --executable-find-relative psci/psc-package-path) " sources" ))
122
+ (process-lines (psci--executable-find-relative psci/psc-package-path) " sources" ))
123
123
((file-exists-p " spago.dhall" )
124
- (process-lines (psci/ --executable-find-relative psci/spago-path) " sources" ))))
124
+ (process-lines (psci--executable-find-relative psci/spago-path) " sources" ))))
125
125
126
- (defun psci/ --executable-find-relative (path )
126
+ (defun psci--executable-find-relative (path )
127
127
" If PATH is a relative path to an executable, return its full path.
128
128
Otherwise, just return PATH."
129
129
(let ((relative (expand-file-name path)))
@@ -140,17 +140,17 @@ If not supplied, the root folder will be guessed using
140
140
`projectile-project-root' (if available), otherwise it will
141
141
default to the current buffer's directory."
142
142
(interactive (list (read-directory-name " Project root? "
143
- (psci/ --project-root!))))
143
+ (psci--project-root!))))
144
144
(let* ((default-directory project-root-folder)
145
145
(psci-program psci/purs-path)
146
- (extra-sources (psci/ --get-psc-package-sources!))
146
+ (extra-sources (psci--get-psc-package-sources!))
147
147
(buffer (comint-check-proc psci/buffer-name)))
148
148
; ; pop to the "*psci*" buffer if the process is dead, the
149
149
; ; buffer is missing or it's got the wrong mode.
150
150
(pop-to-buffer
151
151
(if (or buffer (not (derived-mode-p 'psci-mode ))
152
152
(comint-check-proc (current-buffer )))
153
- (get-buffer-create (or buffer (psci/ --process-name psci/buffer-name)))
153
+ (get-buffer-create (or buffer (psci--process-name psci/buffer-name)))
154
154
(current-buffer )))
155
155
; ; create the comint process if there is no buffer.
156
156
(unless buffer
@@ -197,20 +197,20 @@ default to the current buffer's directory."
197
197
(defun psci/load-module! ()
198
198
" Load the module inside the repl session."
199
199
(interactive )
200
- (-when-let (module-name (psci/ --compute-module-name!))
201
- (psci/ --run-psci-command! (format " import %s " module-name))))
200
+ (-when-let (module-name (psci--compute-module-name!))
201
+ (psci--run-psci-command! (format " import %s " module-name))))
202
202
203
203
;;;### autoload
204
204
(defun psci/reset! ()
205
205
" Reset the current status of the repl session."
206
206
(interactive )
207
- (psci/ --run-psci-command! " :reset" ))
207
+ (psci--run-psci-command! " :reset" ))
208
208
209
209
;;;### autoload
210
210
(defun psci/quit! ()
211
211
" Quit the psci session."
212
212
(interactive )
213
- (psci/ --run-psci-command! " :quit" ))
213
+ (psci--run-psci-command! " :quit" ))
214
214
215
215
(defvar inferior-psci-mode-map
216
216
(let ((map (make-sparse-keymap )))
0 commit comments