aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2020-05-25 05:33:07 +0530
committerArun Isaac2020-05-25 05:44:15 +0530
commit4e76a0aeb91348843d779b47372563e977132a29 (patch)
tree9c44db8811eec73a70ebe1b7e9161ca4cbcdc043
parent8a1b7f6b5534bc02692f7a02d0dc287dc46ca4c1 (diff)
downloadguile-email-4e76a0aeb91348843d779b47372563e977132a29.tar.gz
guile-email-4e76a0aeb91348843d779b47372563e977132a29.tar.lz
guile-email-4e76a0aeb91348843d779b47372563e977132a29.zip
utils: Introduce the not-end-let utility.
* email/utils.scm (not-end-let): New macro. * .dir-locals.el (scheme-mode): Indent not-end-let correctly.
-rw-r--r--.dir-locals.el1
-rw-r--r--email/utils.scm8
2 files changed, 9 insertions, 0 deletions
diff --git a/.dir-locals.el b/.dir-locals.el
index fe85f10..16b44ef 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -5,6 +5,7 @@
(indent-tabs-mode))
(scheme-mode
(eval put 'call-with-port 'scheme-indent-function 1)
+ (eval put 'not-end-let 'scheme-indent-function 1)
(eval put 'test-email= 'scheme-indent-function 1)
(eval put 'test-alist= 'scheme-indent-function 1)))
diff --git a/email/utils.scm b/email/utils.scm
index 984f07e..97c1b5a 100644
--- a/email/utils.scm
+++ b/email/utils.scm
@@ -35,6 +35,14 @@
acons*
alist-combine))
+(define-syntax-rule (not-end-let (var expr) body ...)
+ "Bind result of EXPR to VAR. If VAR is an end-of-file object, return
+it. Else, execute BODY."
+ (let ((var expr))
+ (if (eof-object? var)
+ var
+ (begin body ...))))
+
(define (read-objects read-proc port)
"Read all objects using READ-PROC from PORT and return them as a
list."