diff options
author | Ludovic Courtès | 2011-03-10 18:57:41 +0100 |
---|---|---|
committer | Ludovic Courtès | 2011-03-10 18:57:41 +0100 |
commit | 65f2f4532fb0f04292d8207b801d128fa5e226d1 (patch) | |
tree | 62096efbc9ea9e44becd0270db8043116ce8a031 /src/guile/skribilo/utils/syntax.scm | |
parent | 8e42aef17f1e0e44fcd4aef39ee3f387e644c12b (diff) | |
download | skribilo-65f2f4532fb0f04292d8207b801d128fa5e226d1.tar.gz skribilo-65f2f4532fb0f04292d8207b801d128fa5e226d1.tar.lz skribilo-65f2f4532fb0f04292d8207b801d128fa5e226d1.zip |
Set `%default-port-encoding' to "UTF-8".
* src/guile/skribilo/utils/syntax.scm (default-to-utf-8): New macro.
* src/guile/skribilo.scm (skribilo): Use it around `(doskribe)'.
Diffstat (limited to 'src/guile/skribilo/utils/syntax.scm')
-rw-r--r-- | src/guile/skribilo/utils/syntax.scm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/guile/skribilo/utils/syntax.scm b/src/guile/skribilo/utils/syntax.scm index 5a42b09..471ea14 100644 --- a/src/guile/skribilo/utils/syntax.scm +++ b/src/guile/skribilo/utils/syntax.scm @@ -1,6 +1,6 @@ ;;; syntax.scm -- Syntactic candy for Skribilo modules. -*- coding: utf-8 -*- ;;; -;;; Copyright 2005, 2006, 2007, 2008, 2009, 2010 Ludovic Courtès <ludo@gnu.org> +;;; Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ludovic Courtès <ludo@gnu.org> ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -24,6 +24,7 @@ :use-module (system reader confinement) :export (%skribilo-module-reader skribilo-module-syntax set-correct-file-encoding! + default-to-utf-8 _ N_ unwind-protect unless when)) @@ -94,10 +95,18 @@ ;; Use the encoding specified by the `coding:' comment. (let ((e (false-if-exception (file-encoding port)))) (and (string? e) - (set-port-encoding! port 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))) + #f) + + (define-macro (default-to-utf-8 . rest) #t))) ;;; |