[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
18/24: emacs: Add code to run guix command in REPL.
From: |
Alex Kost |
Subject: |
18/24: emacs: Add code to run guix command in REPL. |
Date: |
Fri, 28 Aug 2015 20:06:36 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit 64a018f1f82e1dbc755a6184ed8b112f3812986c
Author: Alex Kost <address@hidden>
Date: Thu Aug 13 10:51:31 2015 +0300
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.
---
emacs/guix-base.el | 21 +++++++++++++++++++++
emacs/guix-main.scm | 18 ++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 4c7782d..d1593e2 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -1085,6 +1085,27 @@ FILE. With a prefix argument, also prompt for PROFILE."
operation-buffer)))
+;;; Executing guix commands
+
+(defun guix-run-command-in-repl (args)
+ "Execute 'guix ARGS ...' command in Guix REPL."
+ (guix-eval-in-repl
+ (apply #'guix-make-guile-expression
+ 'guix-command args)))
+
+(defun guix-command-output (args)
+ "Return string with 'guix ARGS ...' output."
+ (guix-eval-read
+ (apply #'guix-make-guile-expression
+ 'guix-command-output args)))
+
+(defun guix-help-string (&optional commands)
+ "Return string with 'guix COMMANDS ... --help' output."
+ (guix-eval-read
+ (apply #'guix-make-guile-expression
+ 'help-string commands)))
+
+
;;; Pull
(defcustom guix-update-after-pull t
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 341657d..bd42f8f 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)
- 05/24: emacs: Add utils to make symbol and string for guix command., (continued)
- 05/24: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/28
- 07/24: emacs: Add 'guix-any'., Alex Kost, 2015/08/28
- 08/24: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/28
- 09/24: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/28
- 10/24: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/28
- 11/24: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/28
- 12/24: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/28
- 13/24: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/28
- 17/24: ui: Add 'run-guix'., Alex Kost, 2015/08/28
- 15/24: emacs: Add minibuffer readers., Alex Kost, 2015/08/28
- 18/24: emacs: Add code to run guix command in REPL.,
Alex Kost <=
- 14/24: emacs: Add help variables., Alex Kost, 2015/08/28
- 20/24: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/28
- 23/24: emacs: Use prompt for packages instead popup for edit action., Alex Kost, 2015/08/28
- 19/24: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/28
- 21/24: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/28
- 24/24: emacs: Use popup interface instead 'guix-pull' command., Alex Kost, 2015/08/28
- 16/24: emacs: Add and use alist accessors., Alex Kost, 2015/08/28
- 22/24: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/28