diff options
author | Alex Kost <alezost@gmail.com> | 2015-10-22 10:08:42 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2016-01-02 17:25:35 +0300 |
commit | 73ce3c19c435db51ec818ec62a75e0956b31899f (patch) | |
tree | 3ab30fc747bde31f48000fd1d622b8618aa2d8b8 /emacs/guix-base.el | |
parent | 36c00c61fa257f5177ba9bc54a2d57191b70909f (diff) | |
download | gnu-guix-73ce3c19c435db51ec818ec62a75e0956b31899f.tar gnu-guix-73ce3c19c435db51ec818ec62a75e0956b31899f.tar.gz |
emacs: Add API for 'guix-entry'.
* emacs/guix-info.el: Use new entry procedures.
* emacs/guix-list.el: Likewise.
* emacs/guix-base.el: Likewise.
(guix-get-entry-by-id): Move and rename to ...
* emacs/guix-entry.el (guix-entry-by-id): ...this. New file.
(guix-entry-value, guix-entry-id, guix-entries-by-ids)
(guix-replace-entry): New procedures.
* emacs.am (ELFILES): Add new file.
Diffstat (limited to 'emacs/guix-base.el')
-rw-r--r-- | emacs/guix-base.el | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el index d9c70aae9e..7055a0984e 100644 --- a/emacs/guix-base.el +++ b/emacs/guix-base.el @@ -30,6 +30,7 @@ (require 'cl-lib) (require 'guix-profiles) (require 'guix-backend) +(require 'guix-entry) (require 'guix-guile) (require 'guix-utils) (require 'guix-history) @@ -103,15 +104,15 @@ Each element of the list has a form: (defun guix-get-full-name (entry &optional output) "Return name specification of the package ENTRY and OUTPUT." - (guix-get-name-spec (guix-assq-value entry 'name) - (guix-assq-value entry 'version) + (guix-get-name-spec (guix-entry-value entry 'name) + (guix-entry-value entry 'version) output)) (defun guix-entry-to-specification (entry) "Return name specification by the package or output ENTRY." - (guix-get-name-spec (guix-assq-value entry 'name) - (guix-assq-value entry 'version) - (guix-assq-value entry 'output))) + (guix-get-name-spec (guix-entry-value entry 'name) + (guix-entry-value entry 'version) + (guix-entry-value entry 'output))) (defun guix-entries-to-specifications (entries) "Return name specifications by the package or output ENTRIES." @@ -121,14 +122,8 @@ Each element of the list has a form: (defun guix-get-installed-outputs (entry) "Return list of installed outputs for the package ENTRY." (mapcar (lambda (installed-entry) - (guix-assq-value installed-entry 'output)) - (guix-assq-value entry 'installed))) - -(defun guix-get-entry-by-id (id entries) - "Return entry from ENTRIES by entry ID." - (cl-find-if (lambda (entry) - (equal id (guix-assq-value entry 'id))) - entries)) + (guix-entry-value installed-entry 'output)) + (guix-entry-value entry 'installed))) (defun guix-get-package-id-and-output-by-output-id (oid) "Return list (PACKAGE-ID OUTPUT) by output id OID." @@ -940,9 +935,9 @@ ENTRIES is a list of package entries to get info about packages." (lambda (spec) (let* ((id (car spec)) (outputs (cdr spec)) - (entry (guix-get-entry-by-id id entries))) + (entry (guix-entry-by-id id entries))) (when entry - (let ((location (guix-assq-value entry 'location))) + (let ((location (guix-entry-value entry 'location))) (concat (guix-get-full-name entry) (when outputs (concat ":" |