diff options
author | Alex Kost <alezost@gmail.com> | 2016-01-21 22:07:10 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2016-01-25 22:11:47 +0300 |
commit | 687c9bc0233facde4068ea7f9fed2b2ae931adab (patch) | |
tree | b7416d582c3354c856ba1fa64704434cebfde7dc /emacs/guix-main.scm | |
parent | 6dd460c8565882a9ef3f76cc259bbfe1a9342b6e (diff) | |
download | guix-687c9bc0233facde4068ea7f9fed2b2ae931adab.tar.gz |
emacs: Add interface for licenses.
* emacs/guix-main.scm (%license-param-alist): New variable. (license->sexp, find-licenses, license-entries): New procedures. * emacs/guix-license.el (guix-license-get-entries) (guix-license-get-display, guix-license-insert-packages-button) (guix-license-insert-comment, guix-license-list-describe) (guix-license-list-show-packages): New procedures. (guix-licenses): New command. * doc/emacs.texi (Emacs Licenses): New node. (Emacs Interface): Add it. * doc/guix.texi (Top): Add it. * NEWS: Mention new interface.
Diffstat (limited to 'emacs/guix-main.scm')
-rw-r--r-- | emacs/guix-main.scm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index bec26c7c40..335686ed25 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -1083,3 +1083,25 @@ Return #t if the shell command was executed successfully." "Return a license URI by its name." (and=> (lookup-license name) license-uri)) + +(define %license-param-alist + `((id . ,license-name) + (name . ,license-name) + (url . ,license-uri) + (comment . ,license-comment))) + +(define license->sexp + (object-transformer %license-param-alist)) + +(define (find-licenses search-type . search-values) + "Return a list of licenses depending on SEARCH-TYPE and SEARCH-VALUES." + (case search-type + ((id name) + (let ((names search-values)) + (filter-map lookup-license names))) + ((all) + (licenses)))) + +(define (license-entries search-type . search-values) + (map license->sexp + (apply find-licenses search-type search-values))) |