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.
This commit is contained in:
parent
caa6732e96
commit
5e53b0c5a9
|
@ -1084,6 +1084,27 @@ FILE. With a prefix argument, also prompt for PROFILE."
|
|||
(concat "--manifest=" file))
|
||||
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
|
||||
|
||||
|
|
|
@ -930,6 +930,24 @@ GENERATIONS is a list of generation numbers."
|
|||
(format #t "The source store path: ~a~%"
|
||||
(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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue