diff options
author | Ludovic Courtès | 2008-01-21 10:39:49 +0100 |
---|---|---|
committer | Ludovic Courtès | 2008-01-21 10:39:49 +0100 |
commit | a348f167d4f15d37f5a0a2df856f8f76d5726792 (patch) | |
tree | 0fe712f9887cde9234e8aa85928ccf5540c2d1dd /src | |
parent | 390afd31ccb548a2c2cb87906bdb6026fc64fa3e (diff) | |
download | skribilo-a348f167d4f15d37f5a0a2df856f8f76d5726792.tar.gz skribilo-a348f167d4f15d37f5a0a2df856f8f76d5726792.tar.lz skribilo-a348f167d4f15d37f5a0a2df856f8f76d5726792.zip |
Small fixes making Guile-Lint happier.
* src/guile/skribilo/utils/syntax.scm (unless, when): Don't use `begin'
if EXPRS contains a single expression.
* src/guile/skribilo/writer.scm (copy-markup-writer): Properly handle
NEW-ENGINE, working around `lambda*' deficiencies.
Diffstat (limited to 'src')
-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 |