aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-main.scm
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2016-01-20 18:53:19 +0300
committerAlex Kost <alezost@gmail.com>2016-01-25 22:11:47 +0300
commit83aab70b2d4d11fa345c1fbf2ccdbec8b7ad6662 (patch)
tree649f2a0d01b6b6506284b3af672e4cc7f850a13b /emacs/guix-main.scm
parentcefb7aea9d068a03c79bb6f26ea87082ea214f10 (diff)
downloadpatches-83aab70b2d4d11fa345c1fbf2ccdbec8b7ad6662.tar
patches-83aab70b2d4d11fa345c1fbf2ccdbec8b7ad6662.tar.gz
emacs: Add 'guix-packages-by-license' command.
* emacs/guix-main.scm (packages-by-license): New procedure. (%patterns-makers): Add 'license' search type. * emacs/guix-messages.el (guix-message-packages-by-license): New procedure. (guix-messages): Use it. * emacs/guix-ui-package.el (guix-packages-by-license): New command. * doc/emacs.texi (Emacs Commands): Document it.
Diffstat (limited to 'emacs/guix-main.scm')
-rw-r--r--emacs/guix-main.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 0aee206a15..bec26c7c40 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -403,6 +403,12 @@ MATCH-PARAMS is a list of parameters that REGEXP can match."
(let ((re (make-regexp regexp regexp/icase)))
(matching-packages (cut package-match? <> re))))
+(define (packages-by-license license)
+ "Return a list of packages with LICENSE."
+ (matching-packages
+ (lambda (package)
+ (memq license (list-maybe (package-license package))))))
+
(define (all-available-packages)
"Return a list of all available packages."
(matching-packages (const #t)))
@@ -663,6 +669,9 @@ ENTRIES is a list of installed manifest entries."
(manifest-output-proc (apply-to-first manifest-output-patterns))
(regexp-proc (lambda (_ regexp params . __)
(packages-by-regexp regexp params)))
+ (license-proc (lambda (_ license-name)
+ (packages-by-license
+ (lookup-license license-name))))
(all-proc (lambda _ (all-available-packages)))
(newest-proc (lambda _ (newest-available-packages))))
`((package
@@ -671,6 +680,7 @@ ENTRIES is a list of installed manifest entries."
(installed . ,manifest-package-proc)
(obsolete . ,(apply-to-first obsolete-package-patterns))
(regexp . ,regexp-proc)
+ (license . ,license-proc)
(all-available . ,all-proc)
(newest-available . ,newest-proc))
(output
@@ -679,6 +689,7 @@ ENTRIES is a list of installed manifest entries."
(installed . ,manifest-output-proc)
(obsolete . ,(apply-to-first obsolete-output-patterns))
(regexp . ,regexp-proc)
+ (license . ,license-proc)
(all-available . ,all-proc)
(newest-available . ,newest-proc)))))