1 ;;; guix-ui-location.el --- Interface for displaying package locations
3 ;; Copyright © 2016 Alex Kost <alezost@gmail.com>
5 ;; This file is part of GNU Guix.
7 ;; GNU Guix is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public Location as published by
9 ;; the Free Software Foundation, either version 3 of the Location, or
10 ;; (at your option) any later version.
12 ;; GNU Guix is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public Location for more details.
17 ;; You should have received a copy of the GNU General Public Location
18 ;; along with this program. If not, see <http://www.gnu.org/locations/>.
22 ;; This file provides a 'list' interface for displaying locations of Guix
27 (require 'guix-buffer
)
29 (require 'guix-location
)
30 (require 'guix-backend
)
32 (guix-define-entry-type location
)
34 (defun guix-location-get-entries ()
35 "Receive 'package location' entries."
36 (guix-eval-read "(package-location-entries)"))
41 (guix-list-define-interface location
42 :buffer-name
"*Guix Package Locations*"
43 :get-entries-function
'guix-location-get-entries
44 :format
'((location guix-location-list-file-name-specification
50 t
)
45 (number-of-packages nil
10 guix-list-sort-numerically-1
47 :sort-key
'(location))
49 (let ((map guix-location-list-mode-map
))
50 (define-key map
(kbd "RET") 'guix-location-list-show-packages
)
51 ;; "Location Info" buffer is not defined (it would be useless), so
52 ;; unbind "i" key (by default, it is used to display Info buffer).
53 (define-key map
(kbd "i") nil
))
55 (defun guix-location-list-file-name-specification (location &optional _
)
56 "Return LOCATION button specification for `tabulated-list-entries'."
58 'face
'guix-list-file-name
60 (guix-find-location (button-get btn
'location
)))
62 'help-echo
(concat "Find location: " location
)
65 (declare-function guix-packages-by-location
"guix-ui-package")
67 (defun guix-location-list-show-packages ()
68 "Display packages placed in the location at point."
70 (guix-packages-by-location (guix-list-current-id)))
73 ;;; Interactive commands
76 (defun guix-locations ()
77 "Display locations of the Guix packages."
79 (guix-list-get-display-entries 'location
))
81 (provide 'guix-ui-location
)
83 ;;; guix-ui-location.el ends here