aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-base.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-11-09 11:03:39 +0300
committerAlex Kost <alezost@gmail.com>2014-11-12 22:10:32 +0300
commit0b0fbf0c16a280270c1ce4d716e958d07efbccbd (patch)
treebab5722bb5de079061d458f1da469128abd51852 /emacs/guix-base.el
parentdc05f01cba88bc768a0b12ecfb3760073ff0bc47 (diff)
downloadguix-0b0fbf0c16a280270c1ce4d716e958d07efbccbd.tar
guix-0b0fbf0c16a280270c1ce4d716e958d07efbccbd.tar.gz
emacs: Add "Source" field to 'guix-info' buffers.
Suggested by Ludovic Courtès. * emacs/guix-info.el (guix-info-insert-methods, guix-info-displayed-params): Add 'source' parameter. (guix-package-info-source): New face. (guix-package-source): New button type. (guix-package-info-auto-find-source, guix-package-info-auto-download-source, guix-package-info-download-buffer): New variables. (guix-package-info-show-source, guix-package-info-insert-source-url, guix-package-info-insert-source, guix-package-info-download-source, guix-package-info-redisplay-after-download): New procedures. * emacs/guix-base.el (guix-param-titles): Add 'source' parameter. (guix-operation-prompt): Add 'prompt' argument. (guix-after-source-download-hook): New variable. (guix-package-source-path, guix-package-source-build-derivation): New procedures. * emacs/guix-main.scm (%package-param-alist): Add 'source' parameter. (package-source-names, package-source-derivation->store-path, package-source-path, package-source-build-derivation): New procedures.
Diffstat (limited to 'emacs/guix-base.el')
-rw-r--r--emacs/guix-base.el33
1 files changed, 30 insertions, 3 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index a6e56dced1..23575ac2bf 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -82,6 +82,7 @@ Interactively, prompt for PATH. With prefix, use
(id . "ID")
(name . "Name")
(version . "Version")
+ (source . "Source")
(license . "License")
(synopsis . "Synopsis")
(description . "Description")
@@ -100,6 +101,7 @@ Interactively, prompt for PATH. With prefix, use
(id . "ID")
(name . "Name")
(version . "Version")
+ (source . "Source")
(license . "License")
(synopsis . "Synopsis")
(description . "Description")
@@ -954,13 +956,14 @@ ENTRIES is a list of package entries to get info about packages."
strings)
(insert "\n")))
-(defun guix-operation-prompt ()
+(defun guix-operation-prompt (&optional prompt)
"Prompt a user for continuing the current operation.
-Return non-nil, if the operation should be continued; nil otherwise."
+Return non-nil, if the operation should be continued; nil otherwise.
+Ask a user with PROMPT for continuing an operation."
(let* ((option-keys (mapcar #'guix-operation-option-key
guix-operation-options))
(keys (append '(?y ?n) option-keys))
- (prompt (concat (propertize "Continue operation?"
+ (prompt (concat (propertize (or prompt "Continue operation?")
'face 'minibuffer-prompt)
" ("
(mapconcat
@@ -1035,6 +1038,30 @@ Each element from GENERATIONS is a generation number."
'switch-to-generation profile generation)
operation-buffer)))
+(defun guix-package-source-path (package-id)
+ "Return a store file path to a source of a package PACKAGE-ID."
+ (message "Calculating the source derivation ...")
+ (guix-eval-read
+ (guix-make-guile-expression
+ 'package-source-path package-id)))
+
+(defvar guix-after-source-download-hook nil
+ "Hook run after successful performing a 'source-download' operation.")
+
+(defun guix-package-source-build-derivation (package-id &optional prompt)
+ "Build source derivation of a package PACKAGE-ID.
+Ask a user with PROMPT for continuing an operation."
+ (when (or (not guix-operation-confirm)
+ (guix-operation-prompt (or prompt
+ "Build the source derivation?")))
+ (guix-eval-in-repl
+ (guix-make-guile-expression
+ 'package-source-build-derivation
+ package-id
+ :use-substitutes? (or guix-use-substitutes 'f)
+ :dry-run? (or guix-dry-run 'f))
+ nil 'source-download)))
+
;;; Pull