diff options
| author | Alex Kost <alezost@gmail.com> | 2017-03-18 20:37:31 +0300 |
|---|---|---|
| committer | Alex Kost <alezost@gmail.com> | 2017-03-18 20:49:33 +0300 |
| commit | 209f897682138682f0dfa116cffb2a4780bdb829 (patch) | |
| tree | 9859075f878f72d5104188637a78f560be52d66d | |
| parent | elisp: Add support for "--symlink" option of "guix pack" command (diff) | |
| download | guix-wigust-209f897682138682f0dfa116cffb2a4780bdb829.tar.gz | |
elisp: Add support for "--format" option of "guix pack" command
Follow the changes introduced by
<http://git.savannah.gnu.org/cgit/guix.git/commit/?id=b1edfbc37f2f008188d91f594b046c5986485e47>.
* scheme/emacs-guix/pack.scm (pack-format-names): New procedure.
* scheme/emacs-guix.scm: Autoload it.
* elisp/guix-read.el (guix-pack-format-names)
(guix-read-pack-format-name): New procedures.
* elisp/guix-command.el (guix-command-improve-pack-argument): Complete
"--format" option.
* elisp/guix-pcomplete.el (guix-pcomplete-complete-option-arg): Likewise.
| -rw-r--r-- | elisp/guix-command.el | 1 | ||||
| -rw-r--r-- | elisp/guix-pcomplete.el | 2 | ||||
| -rw-r--r-- | elisp/guix-read.el | 9 | ||||
| -rw-r--r-- | scheme/emacs-guix.scm | 3 | ||||
| -rw-r--r-- | scheme/emacs-guix/pack.scm | 13 |
5 files changed, 26 insertions, 2 deletions
diff --git a/elisp/guix-command.el b/elisp/guix-command.el index ace0920..4664ac1 100644 --- a/elisp/guix-command.el +++ b/elisp/guix-command.el @@ -247,6 +247,7 @@ to be modified." (guix-command-define-argument-improver guix-command-improve-pack-argument '(("--compression" :fun guix-read-compressor-name) + ("--format" :fun guix-read-pack-format-name) ;; "--symlink" is not completed as it should be "FILE-NAME=TARGET". ;; ("--symlink" :fun guix-read-file-name) )) diff --git a/elisp/guix-pcomplete.el b/elisp/guix-pcomplete.el index fcc974d..0babdb1 100644 --- a/elisp/guix-pcomplete.el +++ b/elisp/guix-pcomplete.el @@ -246,6 +246,8 @@ INPUT is the current partially completed string." (cond ((option? "-C" "--compression") (complete* (guix-compressor-names))) + ((option? "-f" "--format") + (complete* (guix-pack-format-names))) ;; Although the argument should be "FILE-NAME=TARGET", it is ;; still better to complete the FILE-NAME than to complete ;; nothing. diff --git a/elisp/guix-read.el b/elisp/guix-read.el index 4dde74e..b455992 100644 --- a/elisp/guix-read.el +++ b/elisp/guix-read.el @@ -51,6 +51,10 @@ "Return a list of names of available compressors." (guix-eval-read "(compressor-names)")) +(guix-memoized-defun guix-pack-format-names () + "Return a list of names of available pack formats." + (guix-eval-read "(pack-format-names)")) + (guix-memoized-defun guix-package-names () "Return a list of names of available packages." (sort (guix-eval-read "(package-names)") @@ -137,6 +141,11 @@ :single-prompt "Compressor: ") (guix-define-readers + :completions-getter guix-pack-format-names + :single-reader guix-read-pack-format-name + :single-prompt "Pack format: ") + +(guix-define-readers :completions-getter guix-package-names :require-match nil :single-reader guix-read-package-name diff --git a/scheme/emacs-guix.scm b/scheme/emacs-guix.scm index d337807..f054481 100644 --- a/scheme/emacs-guix.scm +++ b/scheme/emacs-guix.scm @@ -56,7 +56,8 @@ make-package-graph) #:autoload (emacs-guix lint) (lint-checker-names lint-package) - #:autoload (emacs-guix pack) (compressor-names) + #:autoload (emacs-guix pack) (compressor-names + pack-format-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 index 03c9914..cdc2dd8 100644 --- a/scheme/emacs-guix/pack.scm +++ b/scheme/emacs-guix/pack.scm @@ -20,12 +20,23 @@ ;;; Code: (define-module (emacs-guix pack) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) #:use-module (guix scripts pack) - #:export (compressor-names)) + #:export (compressor-names + pack-format-names)) (define (compressor-names) "Return a list of names of available pack compressors." (map (@@ (guix scripts pack) compressor-name) (@@ (guix scripts pack) %compressors))) +(define (pack-format-names) + "Return a list of names of available pack formats." + (filter-map (match-lambda + ((name . _proc) + (symbol->string name)) + (_ #f)) + (@@ (guix scripts pack) %formats))) + ;;; pack.scm ends here |
