~ruther/guix-local

6407ce8ea1b67024e50273b7d6a1773a16a42322 — Alex Kost 10 years ago 762b197
emacs: Add completions for '--type' option of 'refresh' popup.

* guix/scripts/refresh.scm: Export '%updaters'.
* emacs/guix-main.scm (refresh-updater-names): New procedure.
* emacs/guix-base.el (guix-refresh-updater-names): New function.
* emacs/guix-read.el (guix-read-refresh-updater-names,
  guix-read-refresh-updater-names-string): New functions.
* emacs/guix-command.el (guix-command-improve-refresh-argument): Use
  'guix-read-refresh-updater-names-string'.
M emacs/guix-base.el => emacs/guix-base.el +4 -0
@@ 186,6 186,10 @@ For the meaning of location, see `guix-find-location'."
  "Return a list of names of available graph node types."
  (guix-eval-read (guix-make-guile-expression 'graph-type-names)))

(guix-memoized-defun guix-refresh-updater-names ()
  "Return a list of names of available refresh updater types."
  (guix-eval-read (guix-make-guile-expression 'refresh-updater-names)))

(guix-memoized-defun guix-lint-checker-names ()
  "Return a list of names of available lint checkers."
  (guix-eval-read (guix-make-guile-expression 'lint-checker-names)))

M emacs/guix-command.el => emacs/guix-command.el +1 -0
@@ 241,6 241,7 @@ to be modified."
(guix-command-define-argument-improver
    guix-command-improve-refresh-argument
  '(("--select"     :fun guix-read-refresh-subset)
    ("--type"       :fun guix-read-refresh-updater-names-string)
    ("--key-server" :char ?S)))

(guix-command-define-argument-improver

M emacs/guix-main.scm => emacs/guix-main.scm +5 -0
@@ 991,6 991,11 @@ Return #t if the shell command was executed successfully."
  "Return a list of names of available graph node types."
  (map node-type-name %node-types))

(define (refresh-updater-names)
  "Return a list of names of available refresh updater types."
  (map (@ (guix upstream) upstream-updater-name)
       (@ (guix scripts refresh) %updaters)))

(define (lint-checker-names)
  "Return a list of names of available lint checkers."
  (map (lambda (checker)

M emacs/guix-read.el => emacs/guix-read.el +6 -0
@@ 137,6 137,12 @@ keywords are available:
 :single-prompt "Refresh subset: ")

(guix-define-readers
 :completions-getter guix-refresh-updater-names
 :multiple-reader guix-read-refresh-updater-names
 :multiple-prompt "Refresh updater,s: "
 :multiple-separator ",")

(guix-define-readers
 :completions-var guix-help-key-policies
 :single-reader guix-read-key-policy
 :single-prompt "Key policy: ")

M guix/scripts/refresh.scm => guix/scripts/refresh.scm +2 -1
@@ 42,7 42,8 @@
  #:use-module (srfi srfi-26)
  #:use-module (srfi srfi-37)
  #:use-module (rnrs io ports)
  #:export (guix-refresh))
  #:export (guix-refresh
            %updaters))


;;;