aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-ui-package.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/guix-ui-package.el')
-rw-r--r--emacs/guix-ui-package.el33
1 files changed, 24 insertions, 9 deletions
diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el
index 38f0c08fc7..edc36486fc 100644
--- a/emacs/guix-ui-package.el
+++ b/emacs/guix-ui-package.el
@@ -393,15 +393,17 @@ formatted with this string, an action button is inserted.")
(guix-format-insert nil)
(let ((location-file (car (split-string location ":"))))
(guix-info-insert-value-indent location 'guix-package-location)
- (guix-info-insert-indent)
- (guix-info-insert-action-button
- "Packages"
- (lambda (btn)
- (guix-package-get-display (guix-ui-current-profile)
- 'location
- (button-get btn 'location)))
- (format "Display packages from location '%s'" location-file)
- 'location location-file))))
+ ;; Do not show "Packages" button if a package 'from file' is displayed.
+ (unless (eq (guix-ui-current-search-type) 'from-file)
+ (guix-info-insert-indent)
+ (guix-info-insert-action-button
+ "Packages"
+ (lambda (btn)
+ (guix-package-get-display (guix-ui-current-profile)
+ 'location
+ (button-get btn 'location)))
+ (format "Display packages from location '%s'" location-file)
+ 'location location-file)))))
(defun guix-package-info-insert-systems (systems entry)
"Insert supported package SYSTEMS at point."
@@ -1001,6 +1003,19 @@ Interactively with prefix, prompt for PROFILE."
(guix-package-get-display profile 'location location))
;;;###autoload
+(defun guix-package-from-file (file &optional profile)
+ "Display Guix package that the code from FILE evaluates to.
+If PROFILE is nil, use `guix-current-profile'.
+Interactively with prefix, prompt for PROFILE."
+ (interactive
+ (list (read-file-name "File with package: ")
+ (guix-ui-read-profile)))
+ (guix-buffer-get-display-entries
+ 'info 'package
+ (list (or profile guix-current-profile) 'from-file file)
+ 'add))
+
+;;;###autoload
(defun guix-search-by-regexp (regexp &optional params profile)
"Search for Guix packages by REGEXP.
PARAMS are package parameters that should be searched.