aboutsummaryrefslogtreecommitdiff
path: root/module/hnh
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-04-12 12:01:38 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-04-12 12:01:54 +0200
commit7d1337d069921554e8a649b31a529f4bfcf05d76 (patch)
treef22dc85df17c1c64d664fdde76a200cfa44b9c1a /module/hnh
parentAdd registry of HTTP status codes. (diff)
downloadcalp-7d1337d069921554e8a649b31a529f4bfcf05d76.tar.gz
calp-7d1337d069921554e8a649b31a529f4bfcf05d76.tar.xz
Add with-locale1.
Diffstat (limited to 'module/hnh')
-rw-r--r--module/hnh/util/env.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/module/hnh/util/env.scm b/module/hnh/util/env.scm
index 18ec0543..32ea1cc1 100644
--- a/module/hnh/util/env.scm
+++ b/module/hnh/util/env.scm
@@ -1,5 +1,7 @@
(define-module (hnh util env)
- :export (let-env with-working-directory))
+ :export (let-env
+ with-working-directory
+ with-locale1))
(define-syntax let-env
(syntax-rules ()
@@ -33,3 +35,12 @@
thunk
(lambda () (chdir old-cwd)))))
+
+(define-syntax-rule (with-locale1 category locale thunk)
+ (let ((old #f))
+ (dynamic-wind
+ (lambda ()
+ (set! old (setlocale category))
+ (setlocale category locale))
+ thunk
+ (lambda () (setlocale category old)))))