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.
This commit is contained in:
parent
0546393164
commit
c2379b3c1f
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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."
|
||||
|
Loading…
Reference in New Issue
Block a user