[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
13/23: emacs: Add 'guix-package-names'.
From: |
Alex Kost |
Subject: |
13/23: emacs: Add 'guix-package-names'. |
Date: |
Sun, 30 Aug 2015 15:28:14 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit 25a2839c9dfb72fc4eddf0621b80023f87fc2e2e
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 function.
---
emacs/guix-base.el | 14 ++++++++++++++
emacs/guix-main.scm | 11 +++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 1f4a00c..9cec510 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -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.
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 191aa8d..341657d 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -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)))
- 06/23: emacs: Add utils to copy guix command., (continued)
- 06/23: emacs: Add utils to copy guix command., Alex Kost, 2015/08/30
- 08/23: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/30
- 07/23: emacs: Add 'guix-any'., Alex Kost, 2015/08/30
- 10/23: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/30
- 17/23: ui: Add 'run-guix'., Alex Kost, 2015/08/30
- 11/23: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/30
- 12/23: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/30
- 18/23: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/30
- 15/23: emacs: Add minibuffer readers., Alex Kost, 2015/08/30
- 19/23: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/30
- 13/23: emacs: Add 'guix-package-names'.,
Alex Kost <=
- 14/23: emacs: Add help variables., Alex Kost, 2015/08/30
- 21/23: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/30
- 20/23: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/30
- 23/23: emacs: Use prompt for packages instead popup for edit action., Alex Kost, 2015/08/30
- 16/23: emacs: Add and use alist accessors., Alex Kost, 2015/08/30
- 22/23: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/30