summary refs log tree commit diff
path: root/emacs/guix-main.scm
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-08-13 10:51:31 +0300
committerAlex Kost <alezost@gmail.com>2015-08-30 18:26:02 +0300
commit5e53b0c5a9e1c693d46bdaf24e6b5ce498410da6 (patch)
treea0ba0ee53b904458cf223e6dee7597dfef89ec47 /emacs/guix-main.scm
parentcaa6732e967ef4e397533d1cff9ba5626b2b4131 (diff)
downloadguix-5e53b0c5a9e1c693d46bdaf24e6b5ce498410da6.tar.gz
emacs: Add code to run guix command in REPL.
* emacs/guix-base.el (guix-run-command-in-repl, guix-command-output,
  guix-help-string): New functions.
* emacs/guix-main.scm (guix-command, guix-command-output, help-string):
  New procedures.
Diffstat (limited to 'emacs/guix-main.scm')
-rw-r--r--emacs/guix-main.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 341657d931..bd42f8fc21 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -931,6 +931,24 @@ GENERATIONS is a list of generation numbers."
                 (package-source-derivation->store-path derivation))))))
 
 
+;;; Executing guix commands
+
+(define (guix-command . args)
+  "Run 'guix ARGS ...' command."
+  (catch 'quit
+    (lambda () (apply run-guix args))
+    (const #t)))
+
+(define (guix-command-output . args)
+  "Return string with 'guix ARGS ...' output."
+  (with-output-to-string
+    (lambda () (apply guix-command args))))
+
+(define (help-string . commands)
+  "Return string with 'guix COMMANDS ... --help' output."
+  (apply guix-command-output `(,@commands "--help")))
+
+
 ;;; Lists of packages, lint checkers, etc.
 
 (define (graph-type-names)