diff options
author | Alex Kost <alezost@gmail.com> | 2016-04-05 23:39:03 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2016-05-10 12:05:53 +0300 |
commit | f8476e17a70ecc7d46c746480130477b7c35306b (patch) | |
tree | 155ea4146af6c6a6a416eca3a31fa822fab96c23 /emacs/guix-ui-package.el | |
parent | 3be33289272beda681afa9a48d52fa9a84bcd049 (diff) |
emacs: Add 'guix-package-from-file' command.
* emacs/guix-main.scm (register-package, packages-from-file): New procedures.
(%patterns-makers): Add 'from-file' search type.
* emacs/guix-messages.el (guix-messages): Add messages for it.
* emacs/guix-ui-package.el (guix-package-from-file): New command.
(guix-package-info-insert-location): Adjust for 'from-file' type.
* doc/emacs.texi (Emacs Commands): Document it.
Diffstat (limited to 'emacs/guix-ui-package.el')
-rw-r--r-- | emacs/guix-ui-package.el | 33 |
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. |