[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#28787] [PATCH 1/2] emacs-build-system: Handle missing programs when
From: |
Ludovic Courtès |
Subject: |
[bug#28787] [PATCH 1/2] emacs-build-system: Handle missing programs when patching. |
Date: |
Fri, 13 Oct 2017 23:40:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Hello!
Christopher Baines <address@hidden> skribis:
> Previously the string-append here would error, which isn't useful as it
> doesn't tell you which command couldn't be found. To make the error
> actionable, catch it earlier, and explicitly error.
>
> * guix/build/emacs-build-system.scm (patch-el-files): Handle (which cmd)
> returning #f.
> ---
> guix/build/emacs-build-system.scm | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/guix/build/emacs-build-system.scm
> b/guix/build/emacs-build-system.scm
> index 2404dbddb..0260f15bb 100644
> --- a/guix/build/emacs-build-system.scm
> +++ b/guix/build/emacs-build-system.scm
> @@ -93,7 +93,12 @@ store in '.el' files."
> (substitute-cmd (lambda ()
> (substitute* (find-files "." "\\.el$")
> (("\"/bin/([^.].*)\"" _ cmd)
> - (string-append "\"" (which cmd) "\""))))))
> + (string-append
> + "\""
> + (or
> + (which cmd)
> + (error "patch-el-files: unable to locate "
> cmd))
> + "\""))))))
For clarity I’d move the ‘error’ call out of the way:
diff --git a/guix/build/emacs-build-system.scm
b/guix/build/emacs-build-system.scm
index 2404dbddb..bafb1060b 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -93,7 +93,10 @@ store in '.el' files."
(substitute-cmd (lambda ()
(substitute* (find-files "." "\\.el$")
(("\"/bin/([^.].*)\"" _ cmd)
- (string-append "\"" (which cmd) "\""))))))
+ (let ((cmd (which cmd)))
+ (unless cmd
+ (error "..."))
+ (string-append "\"" cmd "\"")))))))
(with-directory-excursion el-dir
;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still encoded
;; with the "ISO-8859-1" locale.
Otherwise LGTM!
Thanks,
Ludo’.