diff options
-rw-r--r-- | src/guile/skribilo/utils/syntax.scm | 17 | ||||
-rw-r--r-- | src/guile/skribilo/writer.scm | 14 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/guile/skribilo/utils/syntax.scm b/src/guile/skribilo/utils/syntax.scm index adf4297..3c58fb8 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. ;;; -;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludovic.courtes@laas.fr> +;;; Copyright 2005, 2006, 2007, 2008 Ludovic Courtès <ludo@gnu.org> ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -72,10 +72,16 @@ (lambda () ,expr2))) (define-macro (unless condition . exprs) - `(if (not ,condition) (begin ,@exprs))) + `(if (not ,condition) + ,(if (null? (cdr exprs)) + (car exprs) + `(begin ,@exprs)))) (define-macro (when condition . exprs) - `(if ,condition (begin ,@exprs))) + `(if ,condition + ,(if (null? (cdr exprs)) + (car exprs) + `(begin ,@exprs)))) ;;; @@ -93,6 +99,9 @@ (ngettext msg msgplural n %skribilo-text-domain)) -;;; arch-tag: 9a0e0638-64f0-480a-ab19-49e8bfcbcd9b +;;; Local Variables: +;;; mode: scheme +;;; coding: latin-1 +;;; End: ;;; syntax.scm ends here diff --git a/src/guile/skribilo/writer.scm b/src/guile/skribilo/writer.scm index 9c00f82..90b8ff3 100644 --- a/src/guile/skribilo/writer.scm +++ b/src/guile/skribilo/writer.scm @@ -1,7 +1,7 @@ ;;; writer.scm -- Markup writers. ;;; +;;; Copyright 2005, 2006, 2008 Ludovic Courtès <ludo@gnu.org> ;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr> -;;; Copyright 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr> ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -122,7 +122,7 @@ (action 'unspecified) (after #f) #:rest engine) - ;;; FIXME: `lambda*' sucks and fails when both optional arguments and + ;;; XXX: `lambda*' sucks and fails when both optional arguments and ;;; keyword arguments are used together. In particular, if ENGINE is not ;;; specified by the caller but other keyword arguments are specified, it ;;; will consider the value of ENGINE to be the first keyword found. @@ -236,14 +236,20 @@ '()))))))) -(define* (copy-markup-writer markup old-engine :optional new-engine +(define* (copy-markup-writer markup old-engine ;; #:optional new-engine :key (predicate 'unspecified) (class 'unspecified) (options 'unspecified) (validate 'unspecified) (before 'unspecified) (action 'unspecified) - (after 'unspecified)) + (after 'unspecified) + :rest args) + (define new-engine + ;; XXX: Work around `lambda*' suckingness (see `markup-writer'). + (and (not (null? args)) + (car args))) + (let ((old (markup-writer-get markup old-engine)) (new-engine (or new-engine old-engine))) (markup-writer markup new-engine |