summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-base.el8
-rw-r--r--emacs/guix-list.el7
-rw-r--r--emacs/guix-main.scm6
3 files changed, 21 insertions, 0 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 851ee895b9..587288eaf9 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -172,6 +172,14 @@ 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."))))
+
 
 ;;; Buffers and auto updating.
 
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 130b240c1e..26dfeacb8c 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -467,6 +467,11 @@ With prefix (if ARG is non-nil), describe entries marked with any mark."
                  (list (guix-list-current-id)))))
     (guix-list-describe-maybe guix-entry-type ids)))
 
+(defun guix-list-edit-package ()
+  "Go to the location of the current package."
+  (interactive)
+  (guix-edit-package (guix-list-current-package-id)))
+
 
 ;;; Displaying packages
 
@@ -505,6 +510,7 @@ likely)."
   :group 'guix-package-list)
 
 (let ((map guix-package-list-mode-map))
+  (define-key map (kbd "e")   'guix-list-edit-package)
   (define-key map (kbd "x")   'guix-package-list-execute)
   (define-key map (kbd "i")   'guix-package-list-mark-install)
   (define-key map (kbd "d")   'guix-package-list-mark-delete)
@@ -662,6 +668,7 @@ The specification is suitable for `guix-process-package-actions'."
 
 (let ((map guix-output-list-mode-map))
   (define-key map (kbd "RET") 'guix-output-list-describe)
+  (define-key map (kbd "e")   'guix-list-edit-package)
   (define-key map (kbd "x")   'guix-output-list-execute)
   (define-key map (kbd "i")   'guix-output-list-mark-install)
   (define-key map (kbd "d")   'guix-output-list-mark-delete)
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index c6e4a8259b..e0dc683d88 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -887,6 +887,12 @@ 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))
+             (location (package-location package)))
+    (location->string location)))
+
 (define (package-source-derivation->store-path derivation)
   "Return a store path of the package source DERIVATION."
   (match (derivation-outputs derivation)