From 83aab70b2d4d11fa345c1fbf2ccdbec8b7ad6662 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Wed, 20 Jan 2016 18:53:19 +0300 Subject: 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. --- emacs/guix-main.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'emacs/guix-main.scm') 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))))) -- cgit v1.2.3