me
/
guix
Archived
1
0
Fork 0

emacs: Use prompt for packages instead popup for edit action.

* emacs/guix-base.el (guix-package-location): New function.
  (guix-edit-package): Rename and move to ...
* emacs/guix.el (guix-edit): ...here.  Make it interactive.
* emacs/guix-command.el (guix-edit-action): New function (alias to
  'guix-edit') to override the popup for edit command in "M-x guix".
* emacs/guix-list.el (guix-list-edit-package): Adjust for 'guix-edit'
  renaming.
* emacs/guix-main.scm (package-location-string): Allow to accept package
  id or package name as argument.
master
Alex Kost 2015-08-17 12:05:05 +03:00
parent 9b0afb0d28
commit eb097f36b1
5 changed files with 23 additions and 12 deletions

View File

@ -172,13 +172,11 @@ If PATH is relative, it is considered to be relative to
(move-to-column col) (move-to-column col)
(recenter 1)))) (recenter 1))))
(defun guix-edit-package (id) (defun guix-package-location (id-or-name)
"Edit (go to location of) package with ID." "Return location of a package with ID-OR-NAME.
(let ((loc (guix-eval-read (guix-make-guile-expression For the meaning of location, see `guix-find-location'."
'package-location-string id)))) (guix-eval-read (guix-make-guile-expression
(if loc 'package-location-string id-or-name)))
(guix-find-location loc)
(message "Couldn't find package location."))))
;;; Receivable lists of packages, lint checkers, etc. ;;; Receivable lists of packages, lint checkers, etc.

View File

@ -627,6 +627,8 @@ EXECUTOR function is called with the current command line arguments."
;;;###autoload (autoload 'guix "guix-command" "Popup window for 'guix'." t) ;;;###autoload (autoload 'guix "guix-command" "Popup window for 'guix'." t)
(guix-command-define-popup-action guix) (guix-command-define-popup-action guix)
(defalias 'guix-edit-action #'guix-edit)
(defvar guix-command-font-lock-keywords (defvar guix-command-font-lock-keywords
(eval-when-compile (eval-when-compile

View File

@ -472,7 +472,7 @@ With prefix (if ARG is non-nil), describe entries marked with any mark."
(defun guix-list-edit-package () (defun guix-list-edit-package ()
"Go to the location of the current package." "Go to the location of the current package."
(interactive) (interactive)
(guix-edit-package (guix-list-current-package-id))) (guix-edit (guix-list-current-package-id)))
;;; Displaying packages ;;; Displaying packages

View File

@ -889,9 +889,10 @@ GENERATIONS is a list of generation numbers."
(with-store store (with-store store
(delete-generations store profile generations))) (delete-generations store profile generations)))
(define (package-location-string package-id) (define (package-location-string id-or-name)
"Return a location string of a package PACKAGE-ID." "Return a location string of a package with ID-OR-NAME."
(and-let* ((package (package-by-id package-id)) (and-let* ((package (or (package-by-id id-or-name)
(first (packages-by-name id-or-name))))
(location (package-location package))) (location (package-location package)))
(location->string location))) (location->string location)))

View File

@ -1,6 +1,6 @@
;;; guix.el --- Interface for GNU Guix package manager ;;; guix.el --- Interface for GNU Guix package manager
;; Copyright © 2014 Alex Kost <alezost@gmail.com> ;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
;; Package-Requires: ((geiser "0.3")) ;; Package-Requires: ((geiser "0.3"))
;; Keywords: tools ;; Keywords: tools
@ -32,6 +32,7 @@
(require 'guix-list) (require 'guix-list)
(require 'guix-info) (require 'guix-info)
(require 'guix-utils) (require 'guix-utils)
(require 'guix-read)
(defgroup guix nil (defgroup guix nil
"Interface for Guix package manager." "Interface for Guix package manager."
@ -193,6 +194,15 @@ Interactively with prefix, prompt for PROFILE."
(float-time from) (float-time from)
(float-time to))) (float-time to)))
;;;###autoload
(defun guix-edit (id-or-name)
"Edit (go to location of) package with ID-OR-NAME."
(interactive (list (guix-read-package-name)))
(let ((loc (guix-package-location id-or-name)))
(if loc
(guix-find-location loc)
(message "Couldn't find package location."))))
(provide 'guix) (provide 'guix)
;;; guix.el ends here ;;; guix.el ends here