summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-ui-generation.el10
-rw-r--r--emacs/guix-ui-package.el23
-rw-r--r--emacs/guix-ui.el7
3 files changed, 16 insertions, 24 deletions
diff --git a/emacs/guix-ui-generation.el b/emacs/guix-ui-generation.el
index 040e5855f8..aa71645b4e 100644
--- a/emacs/guix-ui-generation.el
+++ b/emacs/guix-ui-generation.el
@@ -401,9 +401,7 @@ GENERATION is a generation number of the current profile."
"Display information about all generations.
If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
- (interactive
- (list (and current-prefix-arg
- (guix-profile-prompt))))
+ (interactive (list (guix-ui-read-profile)))
(guix-generation-get-display profile 'all))
;;;###autoload
@@ -413,8 +411,7 @@ If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
(interactive
(list (read-number "The number of last generations: ")
- (and current-prefix-arg
- (guix-profile-prompt))))
+ (guix-ui-read-profile)))
(guix-generation-get-display profile 'last number))
;;;###autoload
@@ -426,8 +423,7 @@ Interactively with prefix, prompt for PROFILE."
(interactive
(list (guix-read-date "Find generations (from): ")
(guix-read-date "Find generations (to): ")
- (and current-prefix-arg
- (guix-profile-prompt))))
+ (guix-ui-read-profile)))
(guix-generation-get-display profile 'time
(float-time from)
(float-time to)))
diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el
index b457539c0d..7d2ce1065d 100644
--- a/emacs/guix-ui-package.el
+++ b/emacs/guix-ui-package.el
@@ -886,8 +886,7 @@ If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
(interactive
(list (read-string "Package name: " nil 'guix-package-search-history)
- (and current-prefix-arg
- (guix-profile-prompt))))
+ (guix-ui-read-profile)))
(guix-package-get-display profile 'name name))
;;;###autoload
@@ -900,9 +899,7 @@ If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
(interactive
(list (read-regexp "Regexp: " nil 'guix-package-search-history)
- nil
- (and current-prefix-arg
- (guix-profile-prompt))))
+ nil (guix-ui-read-profile)))
(guix-package-get-display profile 'regexp regexp
(or params guix-package-search-params)))
@@ -911,9 +908,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about installed Guix packages.
If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
- (interactive
- (list (and current-prefix-arg
- (guix-profile-prompt))))
+ (interactive (list (guix-ui-read-profile)))
(guix-package-get-display profile 'installed))
;;;###autoload
@@ -921,9 +916,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about obsolete Guix packages.
If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
- (interactive
- (list (and current-prefix-arg
- (guix-profile-prompt))))
+ (interactive (list (guix-ui-read-profile)))
(guix-package-get-display profile 'obsolete))
;;;###autoload
@@ -931,9 +924,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about all available Guix packages.
If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
- (interactive
- (list (and current-prefix-arg
- (guix-profile-prompt))))
+ (interactive (list (guix-ui-read-profile)))
(guix-package-get-display profile 'all-available))
;;;###autoload
@@ -941,9 +932,7 @@ Interactively with prefix, prompt for PROFILE."
"Display information about the newest available Guix packages.
If PROFILE is nil, use `guix-current-profile'.
Interactively with prefix, prompt for PROFILE."
- (interactive
- (list (and current-prefix-arg
- (guix-profile-prompt))))
+ (interactive (list (guix-ui-read-profile)))
(guix-package-get-display profile 'newest-available))
(provide 'guix-ui-package)
diff --git a/emacs/guix-ui.el b/emacs/guix-ui.el
index 7b63e63378..7fef7c355c 100644
--- a/emacs/guix-ui.el
+++ b/emacs/guix-ui.el
@@ -47,6 +47,13 @@ generations in 'list' and 'info' buffers.")
(guix-buffer-define-current-args-accessors
"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
&optional params)
"Receive ENTRY-TYPE entries for PROFILE.