mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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.
This commit is contained in:
parent
9b0afb0d28
commit
eb097f36b1
5 changed files with 23 additions and 12 deletions
|
@ -172,13 +172,11 @@ If PATH is relative, it is considered to be relative to
|
|||
(move-to-column col)
|
||||
(recenter 1))))
|
||||
|
||||
(defun guix-edit-package (id)
|
||||
"Edit (go to location of) package with ID."
|
||||
(let ((loc (guix-eval-read (guix-make-guile-expression
|
||||
'package-location-string id))))
|
||||
(if loc
|
||||
(guix-find-location loc)
|
||||
(message "Couldn't find package location."))))
|
||||
(defun guix-package-location (id-or-name)
|
||||
"Return location of a package with ID-OR-NAME.
|
||||
For the meaning of location, see `guix-find-location'."
|
||||
(guix-eval-read (guix-make-guile-expression
|
||||
'package-location-string id-or-name)))
|
||||
|
||||
|
||||
;;; Receivable lists of packages, lint checkers, etc.
|
||||
|
|
|
@ -627,6 +627,8 @@ EXECUTOR function is called with the current command line arguments."
|
|||
;;;###autoload (autoload 'guix "guix-command" "Popup window for 'guix'." t)
|
||||
(guix-command-define-popup-action guix)
|
||||
|
||||
(defalias 'guix-edit-action #'guix-edit)
|
||||
|
||||
|
||||
(defvar guix-command-font-lock-keywords
|
||||
(eval-when-compile
|
||||
|
|
|
@ -472,7 +472,7 @@ With prefix (if ARG is non-nil), describe entries marked with any mark."
|
|||
(defun guix-list-edit-package ()
|
||||
"Go to the location of the current package."
|
||||
(interactive)
|
||||
(guix-edit-package (guix-list-current-package-id)))
|
||||
(guix-edit (guix-list-current-package-id)))
|
||||
|
||||
|
||||
;;; Displaying packages
|
||||
|
|
|
@ -889,9 +889,10 @@ (define (delete-generations* profile generations)
|
|||
(with-store store
|
||||
(delete-generations store profile generations)))
|
||||
|
||||
(define (package-location-string package-id)
|
||||
"Return a location string of a package PACKAGE-ID."
|
||||
(and-let* ((package (package-by-id package-id))
|
||||
(define (package-location-string id-or-name)
|
||||
"Return a location string of a package with ID-OR-NAME."
|
||||
(and-let* ((package (or (package-by-id id-or-name)
|
||||
(first (packages-by-name id-or-name))))
|
||||
(location (package-location package)))
|
||||
(location->string location)))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; 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"))
|
||||
;; Keywords: tools
|
||||
|
@ -32,6 +32,7 @@
|
|||
(require 'guix-list)
|
||||
(require 'guix-info)
|
||||
(require 'guix-utils)
|
||||
(require 'guix-read)
|
||||
|
||||
(defgroup guix nil
|
||||
"Interface for Guix package manager."
|
||||
|
@ -193,6 +194,15 @@ Interactively with prefix, prompt for PROFILE."
|
|||
(float-time from)
|
||||
(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)
|
||||
|
||||
;;; guix.el ends here
|
||||
|
|
Loading…
Reference in a new issue