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
parent
e224495ce1
commit
16f4acbddb
|
@ -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."
|
||||
|
|
Reference in New Issue