summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2016-04-08 11:51:54 +0300
committerAlex Kost <alezost@gmail.com>2016-04-26 12:32:56 +0300
commit57748c27565117b3ad10c7fce67c36ecf5e5d5c7 (patch)
tree73a03d863a1423fd62bc2b6455e9c69cd4dfebf6
parent8472b2fd2d4c4d060b1333c9c527575d965a0ebd (diff)
downloadpatches-57748c27565117b3ad10c7fce67c36ecf5e5d5c7.tar
patches-57748c27565117b3ad10c7fce67c36ecf5e5d5c7.tar.gz
emacs: Add license definition button to License Info buffer.
* emacs/guix-ui-license.el (guix-license-insert-file): New procedure. (guix-license-info-format): Use it.
-rw-r--r--emacs/guix-ui-license.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/emacs/guix-ui-license.el b/emacs/guix-ui-license.el
index ab1d25bfd2..772a16801f 100644
--- a/emacs/guix-ui-license.el
+++ b/emacs/guix-ui-license.el
@@ -29,6 +29,7 @@
(require 'guix-info)
(require 'guix-backend)
(require 'guix-guile)
+(require 'guix-license)
(guix-define-entry-type license)
@@ -64,7 +65,9 @@ SEARCH-TYPE may be one of the following symbols: `all', `id', `name'."
ignore
guix-license-insert-packages-button
(url ignore (simple guix-url))
- guix-license-insert-comment)
+ guix-license-insert-comment
+ ignore
+ guix-license-insert-file)
:titles '((url . "URL")))
(declare-function guix-packages-by-license "guix-ui-package")
@@ -89,6 +92,16 @@ SEARCH-TYPE may be one of the following symbols: `all', `id', `name'."
(guix-info-param-title 'license 'comment))
(guix-info-insert-value-indent comment))))
+(defun guix-license-insert-file (entry)
+ "Insert button to open license definition."
+ (let ((license (guix-entry-value entry 'name)))
+ (guix-insert-button
+ (guix-license-file) 'guix-file
+ 'help-echo (format "Open definition of license '%s'" license)
+ 'action (lambda (btn)
+ (guix-find-license-definition (button-get btn 'license)))
+ 'license license)))
+
;;; License 'list'