[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/04: emacs: Add code to call guile procedures.
From: |
Alex Kost |
Subject: |
03/04: emacs: Add code to call guile procedures. |
Date: |
Tue, 22 Sep 2015 19:07:35 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit f80a7a6c58539bfdc73a45677fb414e0cae0faef
Author: Alex Kost <address@hidden>
Date: Fri Jul 24 18:00:54 2015 +0300
emacs: Add code to call guile procedures.
* emacs/guix-guile.el (guix-guile-make-call-expression): New function.
* emacs/guix-geiser.el: Require 'guix-guile'.
(guix-geiser-call, guix-geiser-call-in-repl): New functions.
---
emacs/guix-geiser.el | 13 +++++++++++++
emacs/guix-guile.el | 7 +++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-geiser.el b/emacs/guix-geiser.el
index de139b7..eb449bc 100644
--- a/emacs/guix-geiser.el
+++ b/emacs/guix-geiser.el
@@ -24,6 +24,7 @@
;;; Code:
(require 'geiser-mode)
+(require 'guix-guile)
(defun guix-geiser-repl ()
"Return the current Geiser REPL."
@@ -79,6 +80,18 @@ If NO-DISPLAY is non-nil, do not switch to the REPL buffer."
(unless no-display
(geiser-repl--switch-to-buffer repl))))
+(defun guix-geiser-call (proc &rest args)
+ "Call (PROC ARGS ...) synchronously using the current Geiser REPL.
+PROC and ARGS should be strings."
+ (guix-geiser-eval
+ (apply #'guix-guile-make-call-expression proc args)))
+
+(defun guix-geiser-call-in-repl (proc &rest args)
+ "Call (PROC ARGS ...) in the current Geiser REPL.
+PROC and ARGS should be strings."
+ (guix-geiser-eval-in-repl
+ (apply #'guix-guile-make-call-expression proc args)))
+
(provide 'guix-geiser)
;;; guix-geiser.el ends here
diff --git a/emacs/guix-guile.el b/emacs/guix-guile.el
index af8c7d2..cff9bd4 100644
--- a/emacs/guix-guile.el
+++ b/emacs/guix-guile.el
@@ -24,6 +24,13 @@
;;; Code:
+(defun guix-guile-make-call-expression (proc &rest args)
+ "Return \"(PROC ARGS ...)\" string.
+PROC and ARGS should be strings."
+ (format "(%s %s)"
+ proc
+ (mapconcat #'identity args " ")))
+
(defun guix-make-guile-expression (fun &rest args)
"Return string containing a guile expression for calling FUN with ARGS."
(format "(%S %s)" fun