[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/6] emacs: Add license/location "Packages" buttons to Info buffe
From: |
Alex Kost |
Subject: |
[PATCH 6/6] emacs: Add license/location "Packages" buttons to Info buffer. |
Date: |
Mon, 4 Apr 2016 22:47:46 +0300 |
* emacs/guix-ui-package.el (guix-package-info-insert-location)
(guix-package-info-insert-license): New procedures.
(guix-package-info-format): Use them.
(guix-output-info-format): Likewise.
---
emacs/guix-ui-package.el | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el
index aba30ab..e6f836d 100644
--- a/emacs/guix-ui-package.el
+++ b/emacs/guix-ui-package.el
@@ -223,9 +223,9 @@ ENTRIES is a list of package entries to get info about
packages."
ignore
(outputs simple guix-package-info-insert-outputs)
(source simple guix-package-info-insert-source)
- (location format (format guix-package-location))
+ (location simple guix-package-info-insert-location)
+ (license simple guix-package-info-insert-license)
(home-url format (format guix-url))
- (license format (format guix-package-license))
(systems format guix-package-info-insert-systems)
(inputs format (format guix-package-input))
(native-inputs format (format guix-package-native-input))
@@ -383,6 +383,38 @@ formatted with this string, an action button is inserted.")
'guix-package-heading
'spec (guix-package-entry->name-specification entry)))
+(defun guix-package-info-insert-location (location &optional _)
+ "Insert package LOCATION at point."
+ (if (null location)
+ (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)))
+ (concat "Show packages from location: " location-file)
+ 'location location-file))))
+
+(defun guix-package-info-insert-license (licenses &optional _)
+ "Insert package LICENSES at point."
+ (if (null licenses)
+ (guix-format-insert nil)
+ (dolist (license licenses)
+ (guix-info-insert-value-indent license 'guix-package-license)
+ (guix-info-insert-indent)
+ (guix-info-insert-action-button
+ "Packages"
+ (lambda (btn)
+ (guix-package-get-display (guix-ui-current-profile)
+ 'license
+ (button-get btn 'license)))
+ (concat "Show packages with license: " license)
+ 'license license))))
+
(defun guix-package-info-insert-systems (systems entry)
"Insert supported package SYSTEMS at point."
(guix-info-insert-value-format
@@ -798,9 +830,9 @@ for all ARGS."
(source simple guix-package-info-insert-source)
(path simple (indent guix-file))
(dependencies simple (indent guix-file))
- (location format (format guix-package-location))
+ (location simple guix-package-info-insert-location)
+ (license simple guix-package-info-insert-license)
(home-url format (format guix-url))
- (license format (format guix-package-license))
(systems format guix-package-info-insert-systems)
(inputs format (format guix-package-input))
(native-inputs format (format guix-package-native-input))
--
2.7.3
- Re: [PATCH 1/6] emacs: Add 'guix-packages-by-location' command., (continued)
[PATCH 4/6] doc: emacs: Add "Locations" section., Alex Kost, 2016/04/04
[PATCH 5/6] emacs: Add interface for package locations., Alex Kost, 2016/04/04
[PATCH 6/6] emacs: Add license/location "Packages" buttons to Info buffer.,
Alex Kost <=
Re: [PATCH 0/6] emacs: Add interface for package locations., Ludovic Courtès, 2016/04/05