summary refs log tree commit diff
path: root/emacs/guix-messages.el
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-messages.el
parentcefb7aea9d068a03c79bb6f26ea87082ea214f10 (diff)
downloadguix-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-messages.el')
-rw-r--r--emacs/guix-messages.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index c4f15dcac2..de0331fff8 100644
--- a/emacs/guix-messages.el
+++ b/emacs/guix-messages.el
@@ -36,6 +36,10 @@
      (name
       ,(lambda (_ entries names)
          (guix-message-packages-by-name entries 'package names)))
+     (license
+      ,(lambda (_ entries licenses)
+         (apply #'guix-message-packages-by-license
+                entries 'package licenses)))
      (regexp
       (0 "No packages matching '%s'." val)
       (1 "A single package matching '%s'." val)
@@ -64,6 +68,10 @@
      (name
       ,(lambda (_ entries names)
          (guix-message-packages-by-name entries 'output names)))
+     (license
+      ,(lambda (_ entries licenses)
+         (apply #'guix-message-packages-by-license
+                entries 'output licenses)))
      (regexp
       (0 "No package outputs matching '%s'." val)
       (1 "A single package output matching '%s'." val)
@@ -159,6 +167,13 @@ Try \"M-x guix-search-by-name\"."
                             (guix-message-string-name (car names))))))
     (message "%s %s." str-beg str-end)))
 
+(defun guix-message-packages-by-license (entries entry-type license)
+  "Display a message for packages or outputs searched by LICENSE."
+  (let* ((count (length entries))
+         (str-beg (guix-message-string-entries count entry-type))
+         (str-end (format "with license '%s'" license)))
+    (message "%s %s." str-beg str-end)))
+
 (defun guix-message-generations-by-time (profile entries times)
   "Display a message for generations searched by TIMES."
   (let* ((count (length entries))