aboutsummaryrefslogtreecommitdiff
path: root/src/guile/skribilo/utils/syntax.scm
diff options
context:
space:
mode:
Diffstat (limited to 'src/guile/skribilo/utils/syntax.scm')
-rw-r--r--src/guile/skribilo/utils/syntax.scm58
1 files changed, 15 insertions, 43 deletions
diff --git a/src/guile/skribilo/utils/syntax.scm b/src/guile/skribilo/utils/syntax.scm
index 5c606fc..e10fd18 100644
--- a/src/guile/skribilo/utils/syntax.scm
+++ b/src/guile/skribilo/utils/syntax.scm
@@ -71,49 +71,21 @@
(lambda () ,expr1)
(lambda () ,expr2)))
-(cond-expand
- ((not guile-2)
- ;; In Guile 2.x these macros are defined in the core.
- (begin
- (define-macro (unless condition . exprs)
- `(if (not ,condition)
- ,(if (null? (cdr exprs))
- (car exprs)
- `(begin ,@exprs))))
-
- (define-macro (when condition . exprs)
- `(if ,condition
- ,(if (null? (cdr exprs))
- (car exprs)
- `(begin ,@exprs))))
-
- (export when unless)))
- (else (begin)))
-
-(cond-expand
- (guile-2
- (define-syntax set-correct-file-encoding!
- (syntax-rules ()
- ((_)
- (set-correct-file-encoding! (current-input-port)))
- ((_ port)
- ;; Use the encoding specified by the `coding:' comment.
- (let ((e (false-if-exception (file-encoding port))))
- (and (string? e)
- (set-port-encoding! port e))))))
-
- (define-syntax default-to-utf-8
- (syntax-rules ()
- ((_ body ...)
- (with-fluids ((%default-port-encoding "UTF-8"))
- body ...)))))
-
- (else
- (define-macro (set-correct-file-encoding! . p)
- #f)
-
- (define-macro (default-to-utf-8 . body)
- `(begin ,@body))))
+(define-syntax set-correct-file-encoding!
+ (syntax-rules ()
+ ((_)
+ (set-correct-file-encoding! (current-input-port)))
+ ((_ port)
+ ;; Use the encoding specified by the `coding:' comment.
+ (let ((e (false-if-exception (file-encoding port))))
+ (and (string? e)
+ (set-port-encoding! port e))))))
+
+(define-syntax default-to-utf-8
+ (syntax-rules ()
+ ((_ body ...)
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ body ...))))
;;;