summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2017-03-13 18:06:29 +0300
committerAlex Kost <alezost@gmail.com>2017-03-13 18:09:59 +0300
commita1dd003c16e9464f945bf2cff46ecf6a219b14e5 (patch)
tree8c008d63a2f12ca8412c0747328a219da3e0d09c
parentelisp/pcomplete: Complete package names for "guix copy" (diff)
downloadguix-wigust-a1dd003c16e9464f945bf2cff46ecf6a219b14e5.tar.gz
elisp: Add minibuffer reader for compressor name
* scheme/emacs-guix/pack.scm: New file. (compressor-names): New procedure. * scheme/emacs-guix.scm: Autoload it. * elisp/guix-read.el (guix-compressor-names, guix-read-compressor-name): New procedures. * scheme/Makefile.am (MODULES): Add "pack.scm"
-rw-r--r--elisp/guix-read.el9
-rw-r--r--scheme/Makefile.am1
-rw-r--r--scheme/emacs-guix.scm1
-rw-r--r--scheme/emacs-guix/pack.scm31
4 files changed, 42 insertions, 0 deletions
diff --git a/elisp/guix-read.el b/elisp/guix-read.el
index a76b5e2..4dde74e 100644
--- a/elisp/guix-read.el
+++ b/elisp/guix-read.el
@@ -47,6 +47,10 @@
"Return a list of names of available lint checkers."
(guix-eval-read "(lint-checker-names)"))
+(guix-memoized-defun guix-compressor-names ()
+ "Return a list of names of available compressors."
+ (guix-eval-read "(compressor-names)"))
+
(guix-memoized-defun guix-package-names ()
"Return a list of names of available packages."
(sort (guix-eval-read "(package-names)")
@@ -128,6 +132,11 @@
:multiple-separator ",")
(guix-define-readers
+ :completions-getter guix-compressor-names
+ :single-reader guix-read-compressor-name
+ :single-prompt "Compressor: ")
+
+(guix-define-readers
:completions-getter guix-package-names
:require-match nil
:single-reader guix-read-package-name
diff --git a/scheme/Makefile.am b/scheme/Makefile.am
index f2da1bb..e0c5257 100644
--- a/scheme/Makefile.am
+++ b/scheme/Makefile.am
@@ -25,6 +25,7 @@ MODULES = \
emacs-guix/utils.scm \
emacs-guix/graph.scm \
emacs-guix/lint.scm \
+ emacs-guix/pack.scm \
emacs-guix/refresh.scm \
emacs-guix/commands.scm \
emacs-guix/licenses.scm \
diff --git a/scheme/emacs-guix.scm b/scheme/emacs-guix.scm
index f80f977..d337807 100644
--- a/scheme/emacs-guix.scm
+++ b/scheme/emacs-guix.scm
@@ -56,6 +56,7 @@
make-package-graph)
#:autoload (emacs-guix lint) (lint-checker-names
lint-package)
+ #:autoload (emacs-guix pack) (compressor-names)
#:autoload (emacs-guix refresh) (refresh-updater-names))
;;; emacs-guix.scm ends here
diff --git a/scheme/emacs-guix/pack.scm b/scheme/emacs-guix/pack.scm
new file mode 100644
index 0000000..03c9914
--- /dev/null
+++ b/scheme/emacs-guix/pack.scm
@@ -0,0 +1,31 @@
+;;; pack.scm --- Code related to "guix pack" command
+
+;; Copyright © 2017 Alex Kost <alezost@gmail.com>
+
+;; This file is part of Emacs-Guix.
+
+;; Emacs-Guix is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Emacs-Guix is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Emacs-Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(define-module (emacs-guix pack)
+ #:use-module (guix scripts pack)
+ #:export (compressor-names))
+
+(define (compressor-names)
+ "Return a list of names of available pack compressors."
+ (map (@@ (guix scripts pack) compressor-name)
+ (@@ (guix scripts pack) %compressors)))
+
+;;; pack.scm ends here