Skip to content
Snippets Groups Projects
Commit 16f4acbd authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

emacs: Gracefully handle wrong package names passed to 'guix-edit'.

Fixes <http://bugs.gnu.org/22933

>.

* emacs/guix-main.scm (package-location-string): Rewrite to handle the
case where 'packages-by-name' returns the empty list.

Co-authored-by: default avatarMathieu Lirzin <mthl@gnu.org>
parent e224495c
No related branches found
No related tags found
No related merge requests found
......@@ -954,10 +954,11 @@ (define (delete-generations* profile generations)
(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)))
(and=> (or (package-by-id id-or-name)
(match (packages-by-name id-or-name)
(() #f)
((package _ ...) package)))
(compose location->string package-location)))
(define (package-source-derivation->store-path derivation)
"Return a store path of the package source DERIVATION."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment