AboutSummaryRefsLogTreeCommitDiffStats
path: root/scm/mcron
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2015-08-15 00:05:22 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-05-07 11:32:19 +0200
commit2947d841016cc225f9ca92f8d126a2fd3deaaa3e (patch)
tree9a022dfe48b0ed6b64e3fe853e75d84ae63bdb55 /scm/mcron
parentc8a123839617aae28d87ee02066da73a451ef450 (diff)
downloadmcron-2947d841016cc225f9ca92f8d126a2fd3deaaa3e.tar.gz
mcron-2947d841016cc225f9ca92f8d126a2fd3deaaa3e.tar.bz2
mcron-2947d841016cc225f9ca92f8d126a2fd3deaaa3e.zip
main: Make 'catch-mcron-error' macro hygienic.
* scm/mcron/main.scm (catch-mcron-error): Use 'define-syntax-rule' instead of 'defmacro'.
Diffstat (limited to 'scm/mcron')
-rw-r--r--scm/mcron/main.scm20
1 files changed, 7 insertions, 13 deletions
diff --git a/scm/mcron/main.scm b/scm/mcron/main.scm
index 227bb8f..99531a8 100644
--- a/scm/mcron/main.scm
+++ b/scm/mcron/main.scm
@@ -64,19 +64,13 @@ When COMMAND is not specified this uses the first element of (command-line)."
(when (and exit-code (not (eq? exit-code 0)))
(primitive-exit exit-code)))
-
-
-;; Code contributed by Sergey Poznyakoff. Execute body. If an 'mcron-error
-;; exception occurs, print its diagnostics and exit with its error code.
-
-(defmacro catch-mcron-error (. body)
- `(catch 'mcron-error
- (lambda ()
- ,@body)
- (lambda (key exit-code . msg)
- (apply mcron-error exit-code msg))))
-
-
+(define-syntax-rule (catch-mcron-error exp ...)
+ "Evaluate EXP .... if an 'mcron-error exception occurs, print its diagnostics
+and exit with its error code."
+ (catch 'mcron-error
+ (lambda () exp ...)
+ (lambda (key exit-code . msg)
+ (apply mcron-error exit-code msg))))
;; We will be doing a lot of testing of the command name, so it makes sense to
;; perform the string comparisons once and for all here.