aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-10-10 23:50:15 +0400
committerAlex Kost <alezost@gmail.com>2014-10-13 14:59:35 +0400
commitc2379b3c1fe169b56d7d960fa31b1d191a779b1b (patch)
treeed20b1173aafbf971e062b550d30ea8a01932cde /emacs
parent0546393164d30c6722ddbf17fc05c424a57e71a4 (diff)
downloadpatches-c2379b3c1fe169b56d7d960fa31b1d191a779b1b.tar
patches-c2379b3c1fe169b56d7d960fa31b1d191a779b1b.tar.gz
emacs: Add 'current' generation parameter.
* emacs/guix-main.scm (generation-param-alist): Add 'current' parameter. * emacs/guix-base.el (guix-param-titles): Add title for 'current' parameter. * emacs/guix-info.el: Display 'current' parameter. (guix-generation-info-current, guix-generation-info-not-current): New faces. (guix-generation-info-insert-current): New procedure. * emacs/guix-list.el: Display 'current' column. (guix-generation-list-get-current): New procedure.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-base.el1
-rw-r--r--emacs/guix-info.el19
-rw-r--r--emacs/guix-list.el11
-rw-r--r--emacs/guix-main.scm15
4 files changed, 36 insertions, 10 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index d31fb79a0a..aafa220f8b 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -107,6 +107,7 @@ Interactively, prompt for PATH. With prefix, use
(id . "ID")
(number . "Number")
(prev-number . "Previous number")
+ (current . "Current")
(path . "Path")
(time . "Time")))
"List for defining titles of entry parameters.
diff --git a/emacs/guix-info.el b/emacs/guix-info.el
index d5226b1286..fc1b585414 100644
--- a/emacs/guix-info.el
+++ b/emacs/guix-info.el
@@ -136,6 +136,7 @@ number of characters, it will be split into several lines.")
(location guix-package-info-insert-location))
(generation
(number guix-generation-info-insert-number)
+ (current guix-generation-info-insert-current)
(path guix-info-insert-file-path)
(time guix-info-insert-time)))
"Methods for inserting parameter values.
@@ -161,7 +162,7 @@ argument.")
(output name version output synopsis path dependencies location home-url
license inputs native-inputs propagated-inputs description)
(installed path dependencies)
- (generation number prev-number time path))
+ (generation number prev-number current time path))
"List of displayed entry parameters.
Each element of the list should have a form:
@@ -613,6 +614,16 @@ ENTRY is an alist with package info."
"Face used for a number of a generation."
:group 'guix-generation-info)
+(defface guix-generation-info-current
+ '((t :inherit guix-package-info-installed-outputs))
+ "Face used if a generation is the current one."
+ :group 'guix-generation-info)
+
+(defface guix-generation-info-not-current
+ '((t nil))
+ "Face used if a generation is not the current one."
+ :group 'guix-generation-info)
+
(defun guix-generation-info-insert-number (number &optional _)
"Insert generation NUMBER and action buttons."
(guix-info-insert-val-default number 'guix-generation-info-number)
@@ -632,6 +643,12 @@ ENTRY is an alist with package info."
"Delete this generation"
'number number))
+(defun guix-generation-info-insert-current (val entry)
+ "Insert boolean value VAL showing whether this generation is current."
+ (if val
+ (guix-info-insert-val-default "Yes" 'guix-generation-info-current)
+ (guix-info-insert-val-default "No" 'guix-generation-info-not-current)))
+
(provide 'guix-info)
;;; guix-info.el ends here
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 9cc381b4be..f9d106b421 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -65,6 +65,7 @@ entries, he will be prompted for confirmation."
(number 5
,(lambda (a b) (guix-list-sort-numerically 0 a b))
:right-align t)
+ (current 10 t)
(time 20 t)
(path 30 t)))
"Columns displayed in list buffers.
@@ -93,8 +94,9 @@ this list have a priority.")
(synopsis . guix-list-get-one-line)
(description . guix-list-get-one-line))
(generation
- (time . guix-list-get-time)
- (path . guix-list-get-file-path)))
+ (current . guix-generation-list-get-current)
+ (time . guix-list-get-time)
+ (path . guix-list-get-file-path)))
"Methods for inserting parameter values in columns.
Each element of the list has a form:
@@ -735,6 +737,11 @@ Also see `guix-package-info-type'."
(define-key map (kbd "i") 'guix-list-describe)
(define-key map (kbd "d") 'guix-generation-list-mark-delete))
+(defun guix-generation-list-get-current (val &optional _)
+ "Return string from VAL showing whether this generation is current.
+VAL is a boolean value."
+ (if val "(current)" ""))
+
(defun guix-generation-list-show-packages ()
"List installed packages for the generation at point."
(interactive)
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index fe599fbf11..7e26876dfa 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -638,13 +638,14 @@ See 'entry-sexps' for details."
(define (generation-param-alist profile)
"Return an alist of generation parameters and procedures for PROFILE."
- (list
- (cons 'id identity)
- (cons 'number identity)
- (cons 'prev-number (cut previous-generation-number profile <>))
- (cons 'path (cut generation-file-name profile <>))
- (cons 'time (lambda (gen)
- (time-second (generation-time profile gen))))))
+ (let ((current (generation-number profile)))
+ `((id . ,identity)
+ (number . ,identity)
+ (prev-number . ,(cut previous-generation-number profile <>))
+ (current . ,(cut = current <>))
+ (path . ,(cut generation-file-name profile <>))
+ (time . ,(lambda (gen)
+ (time-second (generation-time profile gen)))))))
(define (matching-generations profile predicate)
"Return a list of PROFILE generations matching PREDICATE."