summaryrefslogtreecommitdiff
path: root/emacs/guix.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-09-17 17:52:08 +0400
committerAlex Kost <alezost@gmail.com>2014-09-24 16:09:20 +0400
commitdfeb023927799b45616b435d27001b0fbd533c2b (patch)
treeb61ca30271705b6555b054126431c6fbb4725a40 /emacs/guix.el
parent8689901f95499e98e0209e75b4f268bf2af325c1 (diff)
downloadpatches-dfeb023927799b45616b435d27001b0fbd533c2b.tar
patches-dfeb023927799b45616b435d27001b0fbd533c2b.tar.gz
emacs: Use general functions instead of generated ones.
* emacs/guix-base.el: Add and use general functions instead of specialized functions generated by 'guix-define-buffer-type' macro. (guix-buffer-type, guix-entry-type): New variables. (guix-set-vars): Add new variables. (guix-get-show-entries, guix-show-entries, guix-set-buffer) (guix-history-call, guix-make-history-item) (guix-get-params-for-receiving, guix-revert-buffer) (guix-redisplay-buffer): New functions. (guix-define-buffer-type): Do not generate specialized functions. * emacs/guix-info.el (guix-package-info-insert-full-names): Use 'guix-get-show-entries'. (guix-generation-info-insert-number): Likewise. * emacs/guix-list.el (guix-list-describe): New function. (guix-list-define-entry-type): Do not generate specialized one. (guix-generation-list-show-packages): Use 'guix-get-show-entries'. * emacs/guix.el (guix-show-generations-function): Remove. (guix-get-show-packages): Use new functions. (guix-get-show-generations): Likewise.
Diffstat (limited to 'emacs/guix.el')
-rw-r--r--emacs/guix.el38
1 files changed, 21 insertions, 17 deletions
diff --git a/emacs/guix.el b/emacs/guix.el
index 7336f6732e..621dd3b22c 100644
--- a/emacs/guix.el
+++ b/emacs/guix.el
@@ -28,6 +28,7 @@
;;; Code:
+(require 'guix-base)
(require 'guix-list)
(require 'guix-info)
@@ -42,12 +43,6 @@ If nil, show a single package in the info buffer."
:type 'boolean
:group 'guix)
-(defcustom guix-show-generations-function 'guix-generation-list-get-show
- "Default function used to display generations."
- :type '(choice (function-item guix-generation-list-get-show)
- (function-item guix-generation-info-get-show))
- :group 'guix)
-
(defvar guix-search-params '(name synopsis description)
"Default list of package parameters for searching by regexp.")
@@ -62,22 +57,31 @@ SEARCH-VALS.
Results are displayed in the list buffer, unless a single package
is found and `guix-list-single-package' is nil."
- (let* ((list-params (guix-package-list-get-params-for-receiving))
- (packages (guix-get-entries 'package search-type
- search-vals list-params)))
+ (let* ((list-params (guix-get-params-for-receiving
+ 'list 'package))
+ (packages (guix-get-entries 'package
+ search-type search-vals
+ list-params)))
(if (or guix-list-single-package
(cdr packages))
- (guix-package-list-set packages search-type search-vals)
- (let ((info-params (guix-package-info-get-params-for-receiving)))
- (unless (equal list-params info-params)
- ;; If we don't have required info, we should receive it again
- (setq packages (guix-get-entries 'package search-type
- search-vals info-params))))
- (guix-package-info-set packages search-type search-vals))))
+ (guix-set-buffer packages 'list 'package
+ search-type search-vals)
+ (let* ((info-params (guix-get-params-for-receiving
+ 'info 'package))
+ (packages (if (equal list-params info-params)
+ packages
+ ;; If we don't have required info, we should
+ ;; receive it again
+ (guix-get-entries 'package
+ search-type search-vals
+ info-params))))
+ (guix-set-buffer packages 'info 'package
+ search-type search-vals)))))
(defun guix-get-show-generations (search-type &rest search-vals)
"Search for generations and show results."
- (apply guix-show-generations-function search-type search-vals))
+ (apply #'guix-get-show-entries
+ 'list 'generation search-type search-vals))
;;;###autoload
(defun guix-search-by-name (name)