aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-geiser.el
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-06 12:00:29 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-06 12:00:29 +0200
commit933d2fe4cfb380f66af631a2203ec23c367e5b1a (patch)
treef10581ed0da1911eed9b02e69d999ba481d9d3c6 /emacs/guix-geiser.el
parentf8835ff4b3dd59d59bf44838d05d3d60114d15d2 (diff)
parent998afc3608242b75051f43ece36d52474c51e285 (diff)
downloadguix-933d2fe4cfb380f66af631a2203ec23c367e5b1a.tar
guix-933d2fe4cfb380f66af631a2203ec23c367e5b1a.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'emacs/guix-geiser.el')
-rw-r--r--emacs/guix-geiser.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/emacs/guix-geiser.el b/emacs/guix-geiser.el
index 0e6cc03a84..833f5bb2b3 100644
--- a/emacs/guix-geiser.el
+++ b/emacs/guix-geiser.el
@@ -46,11 +46,23 @@ Return a list of strings with result values of evaluation."
(defun guix-geiser-eval-read (str &optional repl)
"Evaluate STR with guile expression using Geiser REPL.
Return elisp expression of the first result value of evaluation."
- ;; Parsing scheme code with elisp `read' is probably not the best idea.
- (read (replace-regexp-in-string
- "#f\\|#<unspecified>" "nil"
- (replace-regexp-in-string
- "#t" "t" (car (guix-geiser-eval str repl))))))
+ ;; The goal is to convert a string with scheme expression into elisp
+ ;; expression.
+ (let ((result (car (guix-geiser-eval str repl))))
+ (cond
+ ((or (string= result "#f")
+ (string= result "#<unspecified>"))
+ nil)
+ ((string= result "#t")
+ t)
+ (t
+ (read (replace-regexp-in-string
+ "[ (]\\(#f\\)" "nil"
+ (replace-regexp-in-string
+ "[ (]\\(#t\\)" "t"
+ result
+ nil nil 1)
+ nil nil 1))))))
(defun guix-repl-send (cmd &optional save-history)
"Send CMD input string to the current REPL buffer.