Skip to content

Commit ef31045

Browse files
authored
Filter sources given to psci (#34)
The new version of spago returns an empty string as a source, which messes psci up. This commit applies a filter to the sources, preventing bad sources from being given to psci.
1 parent 2cc15af commit ef31045

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: psci.el

+10-5
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,18 @@ When FILENAME is nil or not a real file, returns nil."
119119
(search-forward-regexp regexp)
120120
(match-string 1))))
121121

122+
(defun psci--cleanup-sources-filter-predicate! (source)
123+
"Predicate to see if SOURCE is suitable to be given to the psci repl."
124+
(not (string-empty-p source)))
125+
122126
(defun psci--get-psc-package-sources! ()
123127
"Find extra source path globs using purescript package tools,if they appear to be used."
124-
(cond
125-
((file-exists-p "psc-package.json")
126-
(inheritenv (process-lines (psci--executable-find-relative psci/psc-package-path) "sources")))
127-
((or (file-exists-p "spago.dhall") (file-exists-p "spago.yaml"))
128-
(inheritenv (process-lines (psci--executable-find-relative psci/spago-path) "sources")))))
128+
(-filter 'psci--cleanup-sources-filter-predicate!
129+
(cond
130+
((file-exists-p "psc-package.json")
131+
(inheritenv (process-lines (psci--executable-find-relative psci/psc-package-path) "sources")))
132+
((or (file-exists-p "spago.dhall") (file-exists-p "spago.yaml"))
133+
(inheritenv (process-lines (psci--executable-find-relative psci/spago-path) "sources"))))))
129134

130135
(defun psci--executable-find-relative (path)
131136
"If PATH is a relative path to an executable, return its full path.

0 commit comments

Comments
 (0)