diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/guix-base.el | 12 | ||||
-rw-r--r-- | emacs/guix-command.el | 2 | ||||
-rw-r--r-- | emacs/guix-list.el | 2 | ||||
-rw-r--r-- | emacs/guix-main.scm | 7 | ||||
-rw-r--r-- | emacs/guix.el | 12 |
5 files changed, 23 insertions, 12 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el index 4dff0d6170..3bee910b05 100644 --- a/emacs/guix-base.el +++ b/emacs/guix-base.el @@ -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. diff --git a/emacs/guix-command.el b/emacs/guix-command.el index 97a88726df..139724d3d5 100644 --- a/emacs/guix-command.el +++ b/emacs/guix-command.el @@ -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 diff --git a/emacs/guix-list.el b/emacs/guix-list.el index abb02326af..9796464dbf 100644 --- a/emacs/guix-list.el +++ b/emacs/guix-list.el @@ -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 diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index bd42f8fc21..fe224fb582 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -889,9 +889,10 @@ GENERATIONS is a list of generation numbers." (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))) diff --git a/emacs/guix.el b/emacs/guix.el index afe7285696..244696a184 100644 --- a/emacs/guix.el +++ b/emacs/guix.el @@ -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 |