summary refs log tree commit diff
path: root/emacs/guix-base.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-09-19 09:57:36 +0400
committerAlex Kost <alezost@gmail.com>2014-09-24 16:09:20 +0400
commita54a237b5ff714102056079218f1322ced51620b (patch)
tree1c305cf5039ca320360396cef9410415c5bd2621 /emacs/guix-base.el
parent81b339fe315b96a4ff404e9509182b73f89da134 (diff)
downloadguix-a54a237b5ff714102056079218f1322ced51620b.tar.gz
emacs: Add support for displaying outputs.
Suggested by Taylan Ulrich Bayirli/Kammer and Ludovic Courtès.

* emacs/guix-base.el (guix-param-titles): Add output titles.
  (guix-messages): Add output messages.
  (guix-get-package-id-and-output-by-output-id): New procedure.
  (guix-define-buffer-type): Add ':buffer-name' key.
* emacs/guix-info.el: Add "output-info" buffer type.
  (guix-info-insert-methods): Add output methods.
  (guix-info-displayed-params): Add output params.
  (guix-output-info-insert-version, guix-output-info-insert-output): New
  procedures.
* emacs/guix-list.el: Add "output-list" buffer type.
  (guix-list-column-format): Add output formats.
  (guix-list-column-value-methods): Add output methods.
  (guix-package-list-type): New variable.
  (guix-generation-list-show-packages): Use it.
  (guix-package-list-marking-check): Use 'guix-output-list-mode'.
  (guix-list-mark-package-upgrades): New procedure.
  (guix-package-list-mark-upgrades): Use it.
  (guix-list-execute-package-actions): New procedure.
  (guix-package-list-execute): Use it.
  (guix-list-describe-maybe): New procedure.
  (guix-list-describe): Use it.
  (guix-output-list-mark-install, guix-output-list-mark-delete,
  guix-output-list-mark-upgrade, guix-output-list-mark-upgrades,
  guix-output-list-execute, guix-output-list-make-action,
  guix-output-list-describe): New procedures.
  (guix-output-list-describe-type): New variable.
* emacs/guix.el (guix-get-show-packages): Use 'guix-package-list-type'.
* doc/emacs.texi (emacs Commands): Mention 'guix-package-list-type'.
  (emacs List buffer): Adjust accordingly.
  (emacs Info buffer): Likewise.
  (emacs Buffer Names): New node.
  (emacs Keymaps): Add keymaps for output buffers.
Diffstat (limited to 'emacs/guix-base.el')
-rw-r--r--emacs/guix-base.el69
1 files changed, 65 insertions, 4 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 049d976912..98ee315688 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -87,6 +87,22 @@ Interactively, prompt for PATH.  With prefix, use
      (path              . "Installed path")
      (dependencies      . "Dependencies")
      (output            . "Output"))
+    (output
+     (id                . "ID")
+     (name              . "Name")
+     (version           . "Version")
+     (license           . "License")
+     (synopsis          . "Synopsis")
+     (description       . "Description")
+     (home-url          . "Home page")
+     (output            . "Output")
+     (inputs            . "Inputs")
+     (native-inputs     . "Native inputs")
+     (propagated-inputs . "Propagated inputs")
+     (location          . "Location")
+     (installed         . "Installed")
+     (path              . "Installed path")
+     (dependencies      . "Dependencies"))
     (generation
      (id                . "ID")
      (number            . "Number")
@@ -130,6 +146,14 @@ Each element of the list has a form:
                 (equal id (guix-get-key-val entry 'id)))
               entries))
 
+(defun guix-get-package-id-and-output-by-output-id (oid)
+  "Return list (PACKAGE-ID OUTPUT) by output id OID."
+  (cl-multiple-value-bind (pid-str output)
+      (split-string oid ":")
+    (let ((pid (string-to-number pid-str)))
+      (list (if (= 0 pid) pid-str pid)
+            output))))
+
 
 ;;; Location of the packages
 
@@ -227,6 +251,9 @@ The following stuff should be defined outside this macro:
 Remaining argument (ARGS) should have a form [KEYWORD VALUE] ...  The
 following keywords are available:
 
+  - `:buffer-name' - default value for the defined
+    `guix-TYPE-buffer-name' variable.
+
   - `:required' - default value for the defined
     `guix-TYPE-required-params' variable.
 
@@ -252,6 +279,7 @@ following keywords are available:
          (revert-var     (intern (concat prefix "-revert-no-confirm")))
          (history-var    (intern (concat prefix "-history-size")))
          (params-var     (intern (concat prefix "-required-params")))
+         (buf-name-val   (format "*Guix %s %s*" Entry-type-str Buf-type-str))
          (revert-val     nil)
          (history-val    20)
          (params-val     '(id)))
@@ -262,6 +290,7 @@ following keywords are available:
 	(`:required     (setq params-val (pop args)))
 	(`:history-size (setq history-val (pop args)))
 	(`:revert       (setq revert-val (pop args)))
+        (`:buffer-name  (setq buf-name-val (pop args)))
 	(_ (pop args))))
 
     `(progn
@@ -270,8 +299,7 @@ following keywords are available:
          :prefix ,(concat prefix "-")
          :group ',(intern (concat "guix-" buf-type-str)))
 
-       (defcustom ,buf-name-var ,(format "*Guix %s %s*"
-                                         Entry-type-str Buf-type-str)
+       (defcustom ,buf-name-var ,buf-name-val
          ,(concat "Default name of the " buf-str " for displaying " entry-str ".")
          :type 'string
          :group ',group)
@@ -470,8 +498,8 @@ This function will not update the information, use
       (many "%d newest available packages." count))
      (installed
       (0 "No installed packages.")
-      (1 "A single installed package.")
-      (many "%d installed packages." count))
+      (1 "A single package installed.")
+      (many "%d packages installed." count))
      (obsolete
       (0 "No obsolete packages.")
       (1 "A single obsolete package.")
@@ -480,6 +508,39 @@ This function will not update the information, use
       (0 "No packages installed in generation %d." val)
       (1 "A single package installed in generation %d." val)
       (many "%d packages installed in generation %d." count val)))
+    (output
+     (id
+      (0 "Package outputs not found.")
+      (1 "")
+      (many "%d package outputs." count))
+     (name
+      (0 "The package output '%s' not found." val)
+      (1 "A single package output with name '%s'." val)
+      (many "%d package outputs with '%s' name." count val))
+     (regexp
+      (0 "No package outputs matching '%s'." val)
+      (1 "A single package output matching '%s'." val)
+      (many "%d package outputs matching '%s'." count val))
+     (all-available
+      (0 "No package outputs are available for some reason.")
+      (1 "A single available package output (that's strange).")
+      (many "%d available package outputs." count))
+     (newest-available
+      (0 "No package outputs are available for some reason.")
+      (1 "A single newest available package output (that's strange).")
+      (many "%d newest available package outputs." count))
+     (installed
+      (0 "No installed package outputs.")
+      (1 "A single package output installed.")
+      (many "%d package outputs installed." count))
+     (obsolete
+      (0 "No obsolete package outputs.")
+      (1 "A single obsolete package output.")
+      (many "%d obsolete package outputs." count))
+     (generation
+      (0 "No package outputs installed in generation %d." val)
+      (1 "A single package output installed in generation %d." val)
+      (many "%d package outputs installed in generation %d." count val)))
     (generation
      (id
       (0 "Generations not found.")