emacs: Add 'guix-ui-read-profile'.

* emacs/guix-ui.el (guix-ui-read-profile): New procedure.
* emacs/guix-ui-package.el (guix-search-by-name)
  (guix-search-by-regexp, guix-installed-packages)
  (guix-obsolete-packages, guix-all-available-packages)
  (guix-newest-available-packages): Use it.
* emacs/guix-ui-generation.el (guix-generations)
  (guix-last-generations, guix-generations-by-time): Use it.
This commit is contained in:
Alex Kost 2015-12-18 11:34:48 +03:00
parent 8ed2c92eb1
commit 494a62f215
3 changed files with 16 additions and 24 deletions

View File

@ -401,9 +401,7 @@ GENERATION is a generation number of the current profile."
"Display information about all generations. "Display information about all generations.
If PROFILE is nil, use `guix-current-profile'. If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive (list (guix-ui-read-profile)))
(list (and current-prefix-arg
(guix-profile-prompt))))
(guix-generation-get-display profile 'all)) (guix-generation-get-display profile 'all))
;;;###autoload ;;;###autoload
@ -413,8 +411,7 @@ If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive
(list (read-number "The number of last generations: ") (list (read-number "The number of last generations: ")
(and current-prefix-arg (guix-ui-read-profile)))
(guix-profile-prompt))))
(guix-generation-get-display profile 'last number)) (guix-generation-get-display profile 'last number))
;;;###autoload ;;;###autoload
@ -426,8 +423,7 @@ Interactively with prefix, prompt for PROFILE."
(interactive (interactive
(list (guix-read-date "Find generations (from): ") (list (guix-read-date "Find generations (from): ")
(guix-read-date "Find generations (to): ") (guix-read-date "Find generations (to): ")
(and current-prefix-arg (guix-ui-read-profile)))
(guix-profile-prompt))))
(guix-generation-get-display profile 'time (guix-generation-get-display profile 'time
(float-time from) (float-time from)
(float-time to))) (float-time to)))

View File

@ -886,8 +886,7 @@ If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive
(list (read-string "Package name: " nil 'guix-package-search-history) (list (read-string "Package name: " nil 'guix-package-search-history)
(and current-prefix-arg (guix-ui-read-profile)))
(guix-profile-prompt))))
(guix-package-get-display profile 'name name)) (guix-package-get-display profile 'name name))
;;;###autoload ;;;###autoload
@ -900,9 +899,7 @@ If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive
(list (read-regexp "Regexp: " nil 'guix-package-search-history) (list (read-regexp "Regexp: " nil 'guix-package-search-history)
nil nil (guix-ui-read-profile)))
(and current-prefix-arg
(guix-profile-prompt))))
(guix-package-get-display profile 'regexp regexp (guix-package-get-display profile 'regexp regexp
(or params guix-package-search-params))) (or params guix-package-search-params)))
@ -911,9 +908,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about installed Guix packages. "Display information about installed Guix packages.
If PROFILE is nil, use `guix-current-profile'. If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive (list (guix-ui-read-profile)))
(list (and current-prefix-arg
(guix-profile-prompt))))
(guix-package-get-display profile 'installed)) (guix-package-get-display profile 'installed))
;;;###autoload ;;;###autoload
@ -921,9 +916,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about obsolete Guix packages. "Display information about obsolete Guix packages.
If PROFILE is nil, use `guix-current-profile'. If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive (list (guix-ui-read-profile)))
(list (and current-prefix-arg
(guix-profile-prompt))))
(guix-package-get-display profile 'obsolete)) (guix-package-get-display profile 'obsolete))
;;;###autoload ;;;###autoload
@ -931,9 +924,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about all available Guix packages. "Display information about all available Guix packages.
If PROFILE is nil, use `guix-current-profile'. If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive (list (guix-ui-read-profile)))
(list (and current-prefix-arg
(guix-profile-prompt))))
(guix-package-get-display profile 'all-available)) (guix-package-get-display profile 'all-available))
;;;###autoload ;;;###autoload
@ -941,9 +932,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about the newest available Guix packages. "Display information about the newest available Guix packages.
If PROFILE is nil, use `guix-current-profile'. If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE." Interactively with prefix, prompt for PROFILE."
(interactive (interactive (list (guix-ui-read-profile)))
(list (and current-prefix-arg
(guix-profile-prompt))))
(guix-package-get-display profile 'newest-available)) (guix-package-get-display profile 'newest-available))
(provide 'guix-ui-package) (provide 'guix-ui-package)

View File

@ -47,6 +47,13 @@ generations in 'list' and 'info' buffers.")
(guix-buffer-define-current-args-accessors (guix-buffer-define-current-args-accessors
"guix-ui-current" "profile" "search-type" "search-values") "guix-ui-current" "profile" "search-type" "search-values")
(defun guix-ui-read-profile ()
"Return `guix-current-profile' or prompt for it.
This function is intended for using in `interactive' forms."
(if current-prefix-arg
(guix-profile-prompt)
guix-current-profile))
(defun guix-ui-get-entries (profile entry-type search-type search-values (defun guix-ui-get-entries (profile entry-type search-type search-values
&optional params) &optional params)
"Receive ENTRY-TYPE entries for PROFILE. "Receive ENTRY-TYPE entries for PROFILE.