From: Benno Evers <be...@bmevers.de>

* guix/scripts/edit.scm (guix-edit): Check if %editor exists.
---
These are my first lines of guile, so probably there is a much
better way to do this :D

The previous error message ("execlp: No such file or directory")
had me confused for a while, though.

 guix/scripts/edit.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/guix/scripts/edit.scm b/guix/scripts/edit.scm
index 30146af..9225629 100644
--- a/guix/scripts/edit.scm
+++ b/guix/scripts/edit.scm
@@ -62,6 +62,9 @@ Start $EDITOR to edit the definitions of PACKAGE...\n"))
 
 (define (guix-edit . args)
   (with-error-handling
+    (unless (search-path (parse-path (getenv "PATH")) (%editor))
+      (leave (_ "Couldn't find editor '~a'. Please check $EDITOR and $PATH.")
+             (%editor)))
     (let* ((specs    (parse-command-line args %options '(())
                                          #:argument-handler cons))
            (packages (map specification->package specs)))
-- 
2.5.0


Reply via email to