GNU bug report logs -
#22933
M-x guix-edit fails gracelessly when passed an nonexistent package name
Previous Next
Reported by: ludo <at> gnu.org (Ludovic Courtès)
Date: Mon, 7 Mar 2016 16:30:02 UTC
Severity: normal
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Ludovic Courtès (2016-03-07 19:28 +0300) wrote:
> Currently M-x guix-edit fails badly (actually ‘guix-package-location’)
> pwhen passed the name of a nonexistent package:
[...]
> I think this patch fixes it:
>
>
> 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))))
>
> (define (package-source-derivation->store-path derivation)
> "Return a store path of the package source DERIVATION."
>
> Thoughts?
Great! Thanks for fixing it! Feel free (you or Mathieu) to push any of
your patches.
--
Alex
This bug report was last modified 9 years and 134 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.