aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-ui-package.el
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-05-13 02:03:22 -0400
committerLeo Famulari <leo@famulari.name>2016-05-13 02:08:11 -0400
commiteb74eb4199db3faac654114257996f244ec308f5 (patch)
tree9504ae968710941557be6d1edd244618eeb14448 /emacs/guix-ui-package.el
parentf10e7ef475da430afa46e0b062010952ed886694 (diff)
parente9017c98d61f305b624bacaa30e8891ec0100980 (diff)
downloadguix-eb74eb4199db3faac654114257996f244ec308f5.tar
guix-eb74eb4199db3faac654114257996f244ec308f5.tar.gz
Merge branch 'master' into core-updates
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.