Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 023bf79

Browse filesBrowse files
committed
Improve the load file's content function
1 parent aaad6fe commit 023bf79
Copy full SHA for 023bf79

File tree

1 file changed

+6
-4
lines changed
Filter options

1 file changed

+6
-4
lines changed

‎psci.el

Copy file name to clipboardExpand all lines: psci.el
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@
148148
"The default file referencing the purescript modules to load at psci startup.")
149149

150150
(defun psci/--file-content (filename)
151-
"Load the FILENAME's content as a string."
152-
(with-temp-buffer
153-
(insert-file-contents filename)
154-
(buffer-substring-no-properties (point-min) (point-max))))
151+
"Load the FILENAME's content as a string.
152+
When FILENAME is nil or not a real file, returns nil."
153+
(when (and filename (file-exists-p filename))
154+
(with-temp-buffer
155+
(insert-file-contents filename)
156+
(buffer-substring-no-properties (point-min) (point-max)))))
155157

156158
(defun psci/--symbol (sym n)
157159
"Compute the repetition of a symbol SYM N times as a string."

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.