emacs: Add 'guix-package-names'.

* emacs/guix-main.scm (package-names, package-names-lists): New procedures.
* emacs/guix-base.el (guix-package-names): New function.
This commit is contained in:
Alex Kost 2015-08-12 14:40:47 +03:00
parent 43b40c4b15
commit 25a2839c9d
2 changed files with 25 additions and 0 deletions

View File

@ -191,6 +191,20 @@ If PATH is relative, it is considered to be relative to
"Return a list of names of available lint checkers."
(guix-eval-read (guix-make-guile-expression 'lint-checker-names)))
(guix-memoized-defun guix-package-names ()
"Return a list of names of available packages."
(sort
;; Work around <https://github.com/jaor/geiser/issues/64>:
;; list of strings is parsed much slower than list of lists,
;; so we use 'package-names-lists' instead of 'package-names'.
;; (guix-eval-read (guix-make-guile-expression 'package-names))
(mapcar #'car
(guix-eval-read (guix-make-guile-expression
'package-names-lists)))
#'string<))
;;; Buffers and auto updating.

View File

@ -942,3 +942,14 @@ GENERATIONS is a list of generation numbers."
(map (lambda (checker)
(symbol->string (lint-checker-name checker)))
%checkers))
(define (package-names)
"Return a list of names of available packages."
(delete-duplicates
(fold-packages (lambda (pkg res)
(cons (package-name pkg) res))
'())))
;; See the comment to 'guix-package-names' function in "guix-popup.el".
(define (package-names-lists)
(map list (package-names)))