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.
This commit is contained in:
Alex Kost 2016-04-08 11:51:54 +03:00
parent 8472b2fd2d
commit 57748c2756
1 changed files with 14 additions and 1 deletions

View File

@ -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'