[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/20: emacs: Add 'guix-package-names'.
From: |
Alex Kost |
Subject: |
03/20: emacs: Add 'guix-package-names'. |
Date: |
Tue, 18 Aug 2015 09:41:08 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit cc260076584cf348ef9097f83aaf1c55685227af
Author: Alex Kost <address@hidden>
Date: Wed Aug 12 14:40:47 2015 +0300
emacs: Add 'guix-package-names'.
* emacs/guix-main.scm (package-names, package-names-lists): New procedures.
* emacs/guix-base.el (guix-package-names): New variable and function.
---
emacs/guix-base.el | 20 ++++++++++++++++++++
emacs/guix-main.scm | 12 ++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index bfb535e..7ec68ec 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -193,6 +193,26 @@ If PATH is relative, it is considered to be relative to
(guix-eval-read
(guix-make-guile-expression 'lint-checker-names)))))
+(defvar guix-package-names nil
+ "List of names of available packages.")
+
+(defun guix-package-names ()
+ "Return a list of names of available packages."
+ (or guix-package-names
+ (setq guix-package-names
+ (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.
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 2c5b0ba..90d76cc 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -937,3 +937,15 @@ GENERATIONS is a list of generation numbers."
(map (lambda (checker)
(symbol->string (lint-checker-name checker)))
%checkers))
+
+;; TODO Put in (gnu packages)?
+(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)))
- branch wip-emacs-popup-ui created (now 2392984), Alex Kost, 2015/08/18
- 01/20: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/18
- 03/20: emacs: Add 'guix-package-names'.,
Alex Kost <=
- 05/20: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/18
- 04/20: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/18
- 06/20: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/18
- 08/20: emacs: Add 'guix-any'., Alex Kost, 2015/08/18
- 09/20: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/18
- 13/20: ui: Add 'run-guix'., Alex Kost, 2015/08/18
- 02/20: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/18
- 14/20: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/18
- 10/20: emacs: Add help variables., Alex Kost, 2015/08/18
- 07/20: emacs: Add utils to copy guix command., Alex Kost, 2015/08/18