From a348f167d4f15d37f5a0a2df856f8f76d5726792 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 21 Jan 2008 10:39:49 +0100 Subject: 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. --- src/guile/skribilo/utils/syntax.scm | 17 +++++++++++++---- src/guile/skribilo/writer.scm | 14 ++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src') 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 +;;; Copyright 2005, 2006, 2007, 2008 Ludovic Courtès ;;; ;;; ;;; 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 ;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI -;;; Copyright 2005, 2006 Ludovic Courtès ;;; ;;; ;;; 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 -- cgit v1.2.3