[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
32/38: emacs: Add 'guix-list-get-display-entries'.
From: |
Alex Kost |
Subject: |
32/38: emacs: Add 'guix-list-get-display-entries'. |
Date: |
Sat, 02 Jan 2016 14:27:27 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit ddf6948b2204fbb453df9bc2ade48454d3d6ee12
Author: Alex Kost <address@hidden>
Date: Wed Dec 9 23:19:17 2015 +0300
emacs: Add 'guix-list-get-display-entries'.
* emacs/guix-list.el (guix-list-get-display-entries): New procedure.
* emacs/guix-ui-generation.el (guix-generation-get-display): Use it.
---
emacs/guix-list.el | 28 ++++++++++++++++++++++------
emacs/guix-ui-generation.el | 8 ++++----
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 8b37a88..66e0bc8 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -170,12 +170,6 @@ Return a vector made of values of FUN calls."
(cons (guix-list-param-title entry-type param)
rest-spec))))
-(defun guix-list-insert-entries (entries entry-type)
- "Print ENTRY-TYPE ENTRIES in the current buffer."
- (setq tabulated-list-entries
- (guix-list-tabulated-entries entries entry-type))
- (tabulated-list-print))
-
(defun guix-list-tabulated-entries (entries entry-type)
"Return a list of ENTRY-TYPE values for `tabulated-list-entries'."
(mapcar (lambda (entry)
@@ -194,6 +188,28 @@ Parameters are taken from ENTRY-TYPE ENTRY."
(funcall fun val entry)
(guix-get-string val))))))
+
+;;; Displaying entries
+
+(defun guix-list-get-display-entries (entry-type &rest args)
+ "Search for entries and show them in a 'list' buffer preferably."
+ (let ((entries (guix-buffer-get-entries 'list entry-type args)))
+ (if (or (null entries) ; = 0
+ (cdr entries) ; > 1
+ (guix-list-single-entry? entry-type)
+ (null (guix-buffer-value 'info entry-type 'show-entries)))
+ (guix-buffer-display-entries entries 'list entry-type args 'add)
+ (if (equal (guix-buffer-value 'info entry-type 'get-entries)
+ (guix-buffer-value 'list entry-type 'get-entries))
+ (guix-buffer-display-entries entries 'info entry-type args 'add)
+ (guix-buffer-get-display-entries 'info entry-type args 'add)))))
+
+(defun guix-list-insert-entries (entries entry-type)
+ "Print ENTRY-TYPE ENTRIES in the current buffer."
+ (setq tabulated-list-entries
+ (guix-list-tabulated-entries entries entry-type))
+ (tabulated-list-print))
+
(defun guix-list-get-one-line (val &optional _)
"Return one-line string from a multi-line string VAL.
VAL may be nil."
diff --git a/emacs/guix-ui-generation.el b/emacs/guix-ui-generation.el
index 7d6762a..ec6d218 100644
--- a/emacs/guix-ui-generation.el
+++ b/emacs/guix-ui-generation.el
@@ -47,10 +47,10 @@ If PROFILE is nil, use `guix-current-profile'.
See `guix-ui-get-entries' for the meaning of SEARCH-TYPE and
SEARCH-VALUES."
- (let ((args (cl-list* (or profile guix-current-profile)
- search-type search-values)))
- (guix-buffer-get-display-entries
- 'list 'generation args 'add)))
+ (apply #'guix-list-get-display-entries
+ 'generation
+ (or profile guix-current-profile)
+ search-type search-values))
(defun guix-delete-generations (profile generations
&optional operation-buffer)
- 14/38: emacs: list: Split 'guix-list-format' variable., (continued)
- 14/38: emacs: list: Split 'guix-list-format' variable., Alex Kost, 2016/01/02
- 20/38: emacs: Add wrappers for 'history-size' and 'revert-confirm'., Alex Kost, 2016/01/02
- 23/38: emacs: Generalize buffer reverting., Alex Kost, 2016/01/02
- 19/38: emacs: Split 'guix-param-titles' variable., Alex Kost, 2016/01/02
- 25/38: emacs: info: Buttonize package name heading., Alex Kost, 2016/01/02
- 22/38: emacs: Generalize buffer redisplaying., Alex Kost, 2016/01/02
- 21/38: emacs: Split 'guix-root-map' keymap., Alex Kost, 2016/01/02
- 27/38: emacs: info: Get rid of syntactic fontification., Alex Kost, 2016/01/02
- 24/38: emacs: Improve messages for packages found by ID., Alex Kost, 2016/01/02
- 18/38: emacs: info: Split 'guix-info-format' variable., Alex Kost, 2016/01/02
- 32/38: emacs: Add 'guix-list-get-display-entries'.,
Alex Kost <=
- 17/38: emacs: Factorize macros for defining interfaces., Alex Kost, 2016/01/02
- 33/38: emacs: Return nil instead of "" in completing readers., Alex Kost, 2016/01/02
- 31/38: emacs: Add 'list-single' variables., Alex Kost, 2016/01/02
- 29/38: emacs: Reorganize 'readers' code., Alex Kost, 2016/01/02
- 26/38: emacs: Generalize buffer naming., Alex Kost, 2016/01/02
- 35/38: emacs: Add 'guix-ui-read-profile'., Alex Kost, 2016/01/02
- 37/38: emacs: Use "B" key in "Package List" to display latest builds., Alex Kost, 2016/01/02
- 34/38: emacs: Add hierarchy of customization groups., Alex Kost, 2016/01/02
- 38/38: Update NEWS., Alex Kost, 2016/01/02
- 16/38: emacs: info: Generalize inserting and formatting., Alex Kost, 2016/01/02