[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/12: emacs: Add 'guix-package-names'.
From: |
Alex Kost |
Subject: |
03/12: emacs: Add 'guix-package-names'. |
Date: |
Fri, 14 Aug 2015 08:18:14 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit 224a411617bc8d1c541fe34ce3d9fcb0d6dc0d3e
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 2fab6d4..1d66f42 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 65fa9e1..b0ce34f 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 220f64d), Alex Kost, 2015/08/14
- 01/12: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/14
- 02/12: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/14
- 05/12: emacs: Add 'guix-any'., Alex Kost, 2015/08/14
- 03/12: emacs: Add 'guix-package-names'.,
Alex Kost <=
- 04/12: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/14
- 06/12: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/14
- 09/12: emacs: Add code for executing guix commands in REPL., Alex Kost, 2015/08/14
- 10/12: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/14
- 08/12: emacs: Add minibuffer readers., Alex Kost, 2015/08/14
- 07/12: emacs: Move help variables to "guix-help-vars.el"., Alex Kost, 2015/08/14
- 11/12: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/14
- 12/12: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/14