[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent pa
From: |
Mathieu Lirzin |
Subject: |
bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name |
Date: |
Mon, 07 Mar 2016 20:58:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
address@hidden (Ludovic Courtès) writes:
> diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
> index 34da6ac..c5d5d75 100644
> --- a/emacs/guix-main.scm
> +++ b/emacs/guix-main.scm
> @@ -954,10 +954,14 @@ 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)))
> + (define package
> + (or (package-by-id id-or-name)
> + (match (packages-by-name id-or-name)
> + (() #f)
> + ((first . rest) first))))
> +
> + (and package
> + (location->string (package-location package))))
Not related to the bug. but it feels weird to use internal defines for
something else than a procedure.
what about using (not tested):
--8<---------------cut here---------------start------------->8---
(and=> (or (package-by-id id-or-name)
(match (packages-by-name id-or-name)
(() #f)
((pkg ..1) pkg)))
(compose location->string package-location))
--8<---------------cut here---------------end--------------->8---
I know you love my 'pkg' identifier. ;)
--
Mathieu Lirzin
bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name, Alex Kost, 2016/03/07
bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name, Ludovic Courtès, 2016/03/08
bug#22933: M-x guix-edit fails gracelessly when passed an nonexistent package name, Alex Kost, 2016/03/07