aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtes2006-01-03 23:20:25 +0000
committerLudovic Courtes2006-01-03 23:20:25 +0000
commit2b8a108dbe20569d27cd27e9aae27044a9723e98 (patch)
treef8c8618c4370515be567db1f999db69d49823884 /src
parent9529f21f3cd6d7b54e48cec155c39ca964023531 (diff)
parent16077267f2b9018ce714d0b22c684e6addac9db9 (diff)
downloadskribilo-2b8a108dbe20569d27cd27e9aae27044a9723e98.tar.gz
skribilo-2b8a108dbe20569d27cd27e9aae27044a9723e98.tar.lz
skribilo-2b8a108dbe20569d27cd27e9aae27044a9723e98.zip
Cleaned up the use of a Skribe-compatible `gensym'.
* src/guile/skribilo.scm (gensym): Removed. * src/guile/skribilo/lib.scm (define-simple-markup): Comply with Guile's version of `gensym'. (define-simple-container): Likewise. * src/guile/skribilo/skribe/api.scm (gensym): Improved. Exported via `#:replace'. git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-21
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo.scm16
-rw-r--r--src/guile/skribilo/lib.scm6
-rw-r--r--src/guile/skribilo/skribe/api.scm18
3 files changed, 15 insertions, 25 deletions
diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm
index a560b46..e131ff3 100644
--- a/src/guile/skribilo.scm
+++ b/src/guile/skribilo.scm
@@ -39,22 +39,6 @@ exec ${GUILE-guile} --debug -l $0 -c "(apply $main (cdr (command-line)))" "$@"
;;;;
;;;; Code:
-(let ((gensym-orig gensym))
- ;; In Skribe, `gensym' expects a symbol as its (optional) argument, while
- ;; Guile's `gensym' expect a string. XXX
- (set! gensym
- (lambda args
- (if (null? args)
- (gensym-orig)
- (let ((the-arg (car args)))
- (cond ((symbol? the-arg)
- (gensym-orig (symbol->string the-arg)))
- ((string? the-arg)
- (gensym-orig the-arg))
- (else
- (skribe-error 'gensym "Invalid argument type"
- the-arg))))))))
-
(define-module (skribilo)
diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm
index 7a0c306..fc00896 100644
--- a/src/guile/skribilo/lib.scm
+++ b/src/guile/skribilo/lib.scm
@@ -111,7 +111,8 @@
`(define-markup (,markup :rest opts :key ident class loc)
(new markup
(markup ',markup)
- (ident (or ident (symbol->string (gensym ',markup))))
+ (ident (or ident (symbol->string
+ (gensym ',(symbol->string markup)))))
(loc loc)
(class class)
(required-options '())
@@ -126,7 +127,8 @@
`(define-markup (,markup :rest opts :key ident class loc)
(new container
(markup ',markup)
- (ident (or ident (symbol->string (gensym ',markup))))
+ (ident (or ident (symbol->string
+ (gensym ',(symbol->string markup)))))
(loc loc)
(class class)
(required-options '())
diff --git a/src/guile/skribilo/skribe/api.scm b/src/guile/skribilo/skribe/api.scm
index a300606..9a6369d 100644
--- a/src/guile/skribilo/skribe/api.scm
+++ b/src/guile/skribilo/skribe/api.scm
@@ -19,7 +19,8 @@
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;; USA.
-(define-skribe-module (skribilo skribe api))
+(define-skribe-module (skribilo skribe api)
+ :replace (gensym))
;;; Author: Manuel Serrano
;;; Commentary:
@@ -32,13 +33,16 @@
;;; The contents of the file below are unchanged compared to Skribe 1.2d's
;;; `api.scm' file found in the `common' directory.
-(let ((gensym-orig gensym))
+(define %gensym-orig (module-ref the-root-module 'gensym))
+
+(define gensym
;; In Skribe, `gensym' accepts a symbol. Guile's `gensym' accepts only
- ;; strings.
- (set! gensym
- (lambda (obj)
- (gensym-orig (cond ((symbol? obj) (symbol->string obj))
- (else obj))))))
+ ;; strings (or no argument).
+ (lambda obj
+ (apply %gensym-orig
+ (cond ((null? obj) '())
+ ((symbol? (car obj)) (list (symbol->string (car obj))))
+ (else (skribe-error 'gensym "invalid argument" obj))))))
;*---------------------------------------------------------------------*/