edit: Allow command line arguments in $VISUAL and $EDITOR.

* guix/scripts/edit.scm (guix-edit): Fix the assumption that %editor is
a one word command.
This commit is contained in:
Mathieu Lirzin 2015-11-21 14:37:54 +01:00
parent 2f52ad7413
commit b16dbd1311

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mathieu Lirzin <mthl@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -83,8 +84,11 @@ line."
(catch 'system-error (catch 'system-error
(lambda () (lambda ()
(apply execlp (%editor) (%editor) (let ((file-names (append-map package->location-specification
(append-map package->location-specification packages))) packages)))
;; Use `system' instead of `exec' in order to sanely handle
;; possible command line arguments in %EDITOR.
(exit (system (string-join (cons (%editor) file-names))))))
(lambda args (lambda args
(let ((errno (system-error-errno args))) (let ((errno (system-error-errno args)))
(leave (_ "failed to launch '~a': ~a~%") (leave (_ "failed to launch '~a': ~a~%")