summary refs log tree commit diff
path: root/emacs/guix-base.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2016-05-15 11:10:04 +0300
committerAlex Kost <alezost@gmail.com>2016-05-31 23:51:54 +0300
commite98316e69f2480bde709d92ec00db66fd8e66aea (patch)
treedd6f3ca6ed3efc45b414cf0bb3fadeaff57632e8 /emacs/guix-base.el
parent65e5fe54bae67fbd6de225fd8cc909401045a099 (diff)
downloadguix-e98316e69f2480bde709d92ec00db66fd8e66aea.tar.gz
emacs: Add "Build" button to Package Info.
* emacs/guix-main.scm: Use (guix scripts) module for 'build-package'
procedure.
* emacs/guix-base.el (guix-build-package): New procedure.
* emacs/guix-ui-package.el (guix-package-info-insert-build-button): New
procedure.
(guix-package-info-button-functions): New variable.
(guix-package-info-insert-misc): Insert buttons using it.
Diffstat (limited to 'emacs/guix-base.el')
-rw-r--r--emacs/guix-base.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 962010050b..658cfdb5fa 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -231,6 +231,20 @@ Ask a user with PROMPT for continuing an operation."
       :dry-run? (or guix-dry-run 'f))
      nil 'source-download)))
 
+(defun guix-build-package (package-id &optional prompt)
+  "Build package with PACKAGE-ID.
+Ask a user with PROMPT for continuing the build operation."
+  (when (or (not guix-operation-confirm)
+            (guix-operation-prompt (or prompt "Build package?")))
+    (guix-eval-in-repl
+     (format (concat ",run-in-store "
+                     "(build-package (package-by-id %d)"
+                     " #:use-substitutes? %s"
+                     " #:dry-run? %s)")
+             package-id
+             (guix-guile-boolean guix-use-substitutes)
+             (guix-guile-boolean guix-dry-run)))))
+
 ;;;###autoload
 (defun guix-apply-manifest (profile file &optional operation-buffer)
   "Apply manifest from FILE to PROFILE.