summary refs log tree commit diff
path: root/emacs/guix-messages.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-11-02 13:58:21 +0300
committerAlex Kost <alezost@gmail.com>2014-11-04 15:51:22 +0300
commitd38bd08c74009ffa2a3d764054f1ca39c9192fff (patch)
tree011f3ba92f1728ecb857a89c39cfa6fbb62ddd0e /emacs/guix-messages.el
parent62f261d88cb737f9f3f3d2fffacc7d2b5a599d80 (diff)
downloadguix-d38bd08c74009ffa2a3d764054f1ca39c9192fff.tar.gz
emacs: Add interface for comparing generations.
Suggested by Ludovic Courtès.

* doc/emacs.texi (Emacs List buffer): Document new key bindings.
* emacs/guix-base.el (guix-generation-packages-buffer-name-function,
  guix-generation-packages-update-buffer, guix-output-name-width): New
  variables.
  (guix-generation-file, guix-manifest-file, guix-generation-packages,
  guix-generation-packages-buffer-name-default,
  guix-generation-packages-buffer-name-long,
  guix-generation-packages-buffer-name, guix-generation-packages-buffer,
  guix-generation-insert-package, guix-generation-insert-packages,
  guix-profile-generation-manifest-file,
  guix-profile-generation-packages-buffer): New procedures.
* emacs/guix-list.el: Add key bindings for comparing generations.
  (guix-generation-list-generations-to-compare,
  guix-generation-list-show-added-packages,
  guix-generation-list-show-removed-packages, guix-generation-list-compare,
  guix-generation-list-ediff-manifests, guix-generation-list-diff-manifests,
  guix-generation-list-ediff-packages, guix-generation-list-diff-packages,
  guix-generation-list-ediff, guix-generation-list-diff): New procedures.
* emacs/guix-messages.el (guix-messages): Add 'generation-diff' search type.
  (guix-message-outputs-by-diff): New procedure.
* emacs/guix-utils.el (guix-diff-switches): New variable.
  (guix-diff): New procedure.
* emacs/guix-main.scm (package/output-sexps): Handle 'generation-diff' search
  type.
  (manifest-entry->package-specification,
  manifest-entries->package-specifications, generation-package-specifications,
  generation-package-specifications+paths, generation-difference): New
  procedures.
Diffstat (limited to 'emacs/guix-messages.el')
-rw-r--r--emacs/guix-messages.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index 7a0b493ac7..bd985a0670 100644
--- a/emacs/guix-messages.el
+++ b/emacs/guix-messages.el
@@ -99,7 +99,9 @@
       (1 "A single package output installed in generation %d of profile '%s'."
          val profile)
       (many "%d package outputs installed in generation %d of profile '%s'."
-            count val profile)))
+            count val profile))
+     (generation-diff
+      guix-message-outputs-by-diff))
 
     (generation
      (id
@@ -167,6 +169,20 @@
                      "matching time period '%s' - '%s'.")
              str-beg profile time-beg time-end)))
 
+(defun guix-message-outputs-by-diff (profile entries generations)
+  "Display a message for outputs searched by GENERATIONS difference."
+  (let* ((count (length entries))
+         (str-beg (guix-message-string-entries count 'output))
+         (gen1 (car  generations))
+         (gen2 (cadr generations)))
+    (cl-multiple-value-bind (new old str-action)
+        (if (> gen1 gen2)
+            (list gen1 gen2 "added to")
+          (list gen2 gen1 "removed from"))
+      (message (concat "%s %s generation %d comparing with "
+                       "generation %d of profile '%s'.")
+               str-beg str-action new old profile))))
+
 (defun guix-result-message (profile entries entry-type
                             search-type search-vals)
   "Display an appropriate message after displaying ENTRIES."