From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 3/7] emacs: Add code to call guile procedures. Date: Sat, 25 Jul 2015 11:49:53 +0300 Message-ID: <1437814197-6321-4-git-send-email-alezost@gmail.com> References: <1437814197-6321-1-git-send-email-alezost@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIvA8-0004Qq-Sg for guix-devel@gnu.org; Sat, 25 Jul 2015 04:50:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIvA7-00050C-Pk for guix-devel@gnu.org; Sat, 25 Jul 2015 04:50:32 -0400 Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229]:32815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIvA7-0004zd-Gl for guix-devel@gnu.org; Sat, 25 Jul 2015 04:50:31 -0400 Received: by laah7 with SMTP id h7so25717839laa.0 for ; Sat, 25 Jul 2015 01:50:30 -0700 (PDT) In-Reply-To: <1437814197-6321-1-git-send-email-alezost@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org Cc: Alex Kost * emacs/guix-guile.el (guix-guile-make-call-expression): New function. * emacs/guix-geiser.el (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(+) diff --git a/emacs/guix-geiser.el b/emacs/guix-geiser.el index 1f0cf72..14f48c9 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." @@ -62,6 +63,18 @@ Return elisp expression of the first result value of evaluation." (geiser--go-to-repl)) (geiser-repl--send str)) +(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 112262e..87af192 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 -- 2.4.3