guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: emacs: Gracefully handle wrong package names passed to 'guix-edit


From: Ludovic Courtès
Subject: 01/02: emacs: Gracefully handle wrong package names passed to 'guix-edit'.
Date: Tue, 08 Mar 2016 10:11:38 +0000

civodul pushed a commit to branch master
in repository guix.

commit 16f4acbddbb38275a52554caf693017465586ac6
Author: Ludovic Courtès <address@hidden>
Date:   Tue Mar 8 10:59:27 2016 +0100

    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 <address@hidden>
---
 emacs/guix-main.scm |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 34da6ac..86cedfd 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]