aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-main.scm
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/guix-main.scm')
-rw-r--r--emacs/guix-main.scm30
1 files changed, 30 insertions, 0 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 236c882e3c..0aee206a15 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -1042,3 +1042,33 @@ Return #t if the shell command was executed successfully."
;; See the comment to 'guix-package-names' function in "guix-popup.el".
(define (package-names-lists)
(map list (package-names)))
+
+
+;;; Licenses
+
+(define %licenses
+ (delay
+ (filter license?
+ (module-map (lambda (_ var)
+ (variable-ref var))
+ (resolve-interface '(guix licenses))))))
+
+(define (licenses)
+ (force %licenses))
+
+(define (license-names)
+ "Return a list of names of available licenses."
+ (map license-name (licenses)))
+
+(define lookup-license
+ (memoize
+ (lambda (name)
+ "Return a license by its name."
+ (find (lambda (l)
+ (string=? name (license-name l)))
+ (licenses)))))
+
+(define (lookup-license-uri name)
+ "Return a license URI by its name."
+ (and=> (lookup-license name)
+ license-uri))