[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
14/20: emacs: Add code to run guix command in REPL.
From: |
Alex Kost |
Subject: |
14/20: emacs: Add code to run guix command in REPL. |
Date: |
Tue, 18 Aug 2015 09:41:12 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit d749b4a973c4017b05a8ae16edb8a2cdc677eb7d
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-help-string): New
functions.
* emacs/guix-main.scm (guix-command, help-string): New procedures.
---
emacs/guix-base.el | 15 +++++++++++++++
emacs/guix-main.scm | 17 +++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index f9bf129..5e6873c 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -1094,6 +1094,21 @@ 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-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 90d76cc..1d15cf4 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -930,6 +930,23 @@ GENERATIONS is a list of generation numbers."
(package-source-derivation->store-path derivation))))))
+;;; Executing guix commands
+
+(define (guix-command . args)
+ "Run 'guix ARGS ...' command.
+ARGS is a list of strings."
+ (catch 'quit
+ (lambda () (apply run-guix args))
+ (const #t)))
+
+(define (help-string . commands)
+ "Return string with 'guix COMMANDS ... --help' output.
+COMMANDS is a list of strings."
+ (with-output-to-string
+ (lambda ()
+ (apply guix-command `(,@commands "--help")))))
+
+
;;; Lists of packages, lint checkers, etc.
(define (lint-checker-names)
- branch wip-emacs-popup-ui created (now 2392984), Alex Kost, 2015/08/18
- 01/20: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/18
- 03/20: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/18
- 05/20: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/18
- 04/20: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/18
- 06/20: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/18
- 08/20: emacs: Add 'guix-any'., Alex Kost, 2015/08/18
- 09/20: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/18
- 13/20: ui: Add 'run-guix'., Alex Kost, 2015/08/18
- 02/20: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/18
- 14/20: emacs: Add code to run guix command in REPL.,
Alex Kost <=
- 10/20: emacs: Add help variables., Alex Kost, 2015/08/18
- 07/20: emacs: Add utils to copy guix command., Alex Kost, 2015/08/18
- 15/20: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/18
- 20/20: emacs: Use popup interface instead 'guix-pull' command., Alex Kost, 2015/08/18
- 11/20: emacs: Add minibuffer readers., Alex Kost, 2015/08/18
- 16/20: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/18
- 17/20: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/18
- 12/20: emacs: Add and use alist accessors., Alex Kost, 2015/08/18
- 19/20: emacs: Use prompt for packages instead popup for edit action., Alex Kost, 2015/08/18
- 18/20: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/18