me
/
guix
Archived
1
0
Fork 0

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: Mathieu Lirzin <mthl@gnu.org>
master
Ludovic Courtès 2016-03-08 10:59:27 +01:00
parent e224495ce1
commit 16f4acbddb
1 changed files with 5 additions and 4 deletions

View File

@ -954,10 +954,11 @@ GENERATIONS is a list of generation numbers."
(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."