From: Alex Kost <alezost@gmail.com>
To: guix-devel@gnu.org
Subject: [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff'.
Date: Sun, 10 Jan 2016 12:53:48 +0300 [thread overview]
Message-ID: <1452419630-4399-5-git-send-email-alezost@gmail.com> (raw)
In-Reply-To: <1452419630-4399-1-git-send-email-alezost@gmail.com>
* emacs/guix-main.scm (generation-package-specifications): Rename to...
(profile-package-specifications): ... this. Take a single 'profile'
argument.
(generation-difference): Rename to...
(profile-difference): ... this. Take profiles as arguments.
(package/output-sexps): Adjust accordingly.
* emacs/guix-ui-generation.el (guix-generation-list-profiles-to-compare):
New procedure.
(guix-generation-list-show-added-packages)
(guix-generation-list-show-removed-packages): Use it.
* emacs/guix-messages.el (guix-messages): Replace 'generation-diff' with
'profile-diff'.
(guix-message-outputs-by-diff): Adjust accordingly.
---
emacs/guix-main.scm | 23 +++++++++++------------
emacs/guix-messages.el | 21 ++++++++++-----------
emacs/guix-ui-generation.el | 13 +++++++++----
3 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 5460c96..dfa9cba 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -137,10 +137,9 @@ return two values: name and version. For example, for SPEC
(define (manifest-entries->package-specifications entries)
(map manifest-entry->package-specification entries))
-(define (generation-package-specifications profile number)
- "Return a list of package specifications for generation NUMBER."
- (let ((manifest (profile-manifest
- (generation-file-name profile number))))
+(define (profile-package-specifications profile)
+ "Return a list of package specifications for PROFILE."
+ (let ((manifest (profile-manifest profile)))
(manifest-entries->package-specifications
(manifest-entries manifest))))
@@ -153,11 +152,11 @@ Each element of the list is a list of the package specification and its path."
(manifest-entry-item entry)))
(manifest-entries manifest))))
-(define (generation-difference profile number1 number2)
- "Return a list of package specifications for outputs installed in generation
-NUMBER1 and not installed in generation NUMBER2."
- (let ((specs1 (generation-package-specifications profile number1))
- (specs2 (generation-package-specifications profile number2)))
+(define (profile-difference profile1 profile2)
+ "Return a list of package specifications for outputs installed in PROFILE1
+and not installed in PROFILE2."
+ (let ((specs1 (profile-package-specifications profile1))
+ (specs2 (profile-package-specifications profile2)))
(lset-difference string=? specs1 specs2)))
(define (manifest-entries->hash-table entries)
@@ -698,11 +697,11 @@ See 'entry-sexps' for details."
profile))
(manifest (profile-manifest profile))
(patterns (if (and (eq? entry-type 'output)
- (eq? search-type 'generation-diff))
+ (eq? search-type 'profile-diff))
(match search-vals
- ((g1 g2)
+ ((p1 p2)
(map specification->output-pattern
- (generation-difference profile g1 g2)))
+ (profile-difference p1 p2)))
(_ '()))
(apply (patterns-maker entry-type search-type)
manifest search-vals)))
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index eb2a76e..234d3d1 100644
--- a/emacs/guix-messages.el
+++ b/emacs/guix-messages.el
@@ -98,7 +98,7 @@
val profile)
(many "%d package outputs installed in generation %d of profile '%s'."
count val profile))
- (generation-diff
+ (profile-diff
guix-message-outputs-by-diff))
(generation
@@ -183,19 +183,18 @@ Try \"M-x guix-search-by-name\"."
"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."
+(defun guix-message-outputs-by-diff (_ entries profiles)
+ "Display a message for outputs searched by PROFILES difference."
(let* ((count (length entries))
(str-beg (guix-message-string-entries count 'output))
- (gen1 (car generations))
- (gen2 (cadr generations)))
+ (profile1 (car profiles))
+ (profile2 (cadr profiles)))
(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))))
+ (if (string-lessp profile2 profile1)
+ (list profile1 profile2 "added to")
+ (list profile2 profile1 "removed from"))
+ (message "%s %s profile '%s' comparing with profile '%s'."
+ str-beg str-action new old))))
(defun guix-result-message (profile entries entry-type
search-type search-vals)
diff --git a/emacs/guix-ui-generation.el b/emacs/guix-ui-generation.el
index cb32e04..eebcedf 100644
--- a/emacs/guix-ui-generation.el
+++ b/emacs/guix-ui-generation.el
@@ -212,6 +212,11 @@ VAL is a boolean value."
(user-error "2 generations should be marked for comparing")
(sort numbers #'<))))
+(defun guix-generation-list-profiles-to-compare ()
+ "Return a sorted list of 2 marked generation profiles for comparing."
+ (mapcar #'guix-generation-current-packages-profile
+ (guix-generation-list-generations-to-compare)))
+
(defun guix-generation-list-show-added-packages ()
"List package outputs added to the latest marked generation.
If 2 generations are marked with \\[guix-list-mark], display
@@ -221,8 +226,8 @@ installed in the other one."
(guix-buffer-get-display-entries
'list 'output
(cl-list* (guix-ui-current-profile)
- 'generation-diff
- (reverse (guix-generation-list-generations-to-compare)))
+ 'profile-diff
+ (reverse (guix-generation-list-profiles-to-compare)))
'add))
(defun guix-generation-list-show-removed-packages ()
@@ -234,8 +239,8 @@ installed in the other one."
(guix-buffer-get-display-entries
'list 'output
(cl-list* (guix-ui-current-profile)
- 'generation-diff
- (guix-generation-list-generations-to-compare))
+ 'profile-diff
+ (guix-generation-list-profiles-to-compare))
'add))
(defun guix-generation-list-compare (diff-fun gen-fun)
--
2.6.3
next prev parent reply other threads:[~2016-01-10 9:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-10 9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
2016-01-10 9:53 ` [PATCH 1/6] guix system: Export <boot-parameters> accessors Alex Kost
2016-01-12 20:25 ` Ludovic Courtès
2016-01-13 20:44 ` Alex Kost
2016-01-13 22:33 ` Ludovic Courtès
2016-01-14 8:34 ` Alex Kost
2016-01-14 13:25 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 2/6] emacs: profiles: Add 'guix-system-profile' Alex Kost
2016-01-12 20:25 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 3/6] emacs: Find packages in system profiles Alex Kost
2016-01-12 20:28 ` Ludovic Courtès
2016-01-13 20:45 ` Alex Kost
2016-01-13 22:42 ` Ludovic Courtès
2016-01-14 8:38 ` Alex Kost
2016-01-14 13:27 ` Ludovic Courtès
2016-01-10 9:53 ` Alex Kost [this message]
2016-01-12 20:29 ` [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff' Ludovic Courtès
2016-01-10 9:53 ` [PATCH 5/6] emacs: Remove 'generation' search type Alex Kost
2016-01-12 20:31 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 6/6] emacs: Add interface for system generations Alex Kost
2016-01-12 20:35 ` Ludovic Courtès
2016-01-13 20:56 ` Alex Kost
2016-01-13 22:44 ` Ludovic Courtès
2016-01-12 20:23 ` [PATCH 0/6] emacs: Add "M-x guix-system-generations" Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452419630-4399-5-git-send-email-alezost@gmail.com \
--to=alezost@gmail.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.