From 9d8bd8dfbcd71464a17bf3e12546868a5c9e0580 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sun, 23 Jul 2006 20:49:08 +0000 Subject: Fixed `engine-add-writer!' so that the insertion order is kept. * src/guile/skribilo/engine.scm (engine-add-writer!): Use `append' instead of `cons' when adding a writer, so that the insertion order is honored when lookups are performed. This fixes a generation bug (e.g., for the first page of the User Manual) and slightly improves performance. * src/guile/skribilo/writer.scm (lookup-markup-writer): Documented the impact of registration order. git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-22 --- ChangeLog | 21 +++++++++++++++++++++ src/guile/skribilo/engine.scm | 9 ++++++--- src/guile/skribilo/writer.scm | 3 ++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c743e12..69447d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,27 @@ # arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2 # +2006-07-23 14:38:34 GMT Ludovic Courtes patch-61 + + Summary: + Fixed `engine-add-writer!' so that the insertion order is kept. + Revision: + skribilo--devel--1.2--patch-61 + + * src/guile/skribilo/engine.scm (engine-add-writer!): Use `append' + instead of `cons' when adding a writer, so that the insertion order is + honored when lookups are performed. This fixes a generation bug (e.g., + for the first page of the User Manual) and slightly improves + performance. + + * src/guile/skribilo/writer.scm (lookup-markup-writer): Documented the + impact of registration order. + + modified files: + ChangeLog src/guile/skribilo/engine.scm + src/guile/skribilo/writer.scm + + 2006-07-14 14:42:40 GMT Ludovic Courtes patch-59 Summary: diff --git a/src/guile/skribilo/engine.scm b/src/guile/skribilo/engine.scm index c422476..401f9ef 100644 --- a/src/guile/skribilo/engine.scm +++ b/src/guile/skribilo/engine.scm @@ -313,7 +313,9 @@ otherwise the requested engine is returned." ;; Add a writer to engine E. If IDENT is a symbol, then it should denote ;; a markup name and the writer being added is specific to that markup. If ;; IDENT is `#t' (for instance), then it is assumed to be a ``free writer'' - ;; that may apply to any kind of markup for which PRED returns true. + ;; that may apply to any kind of markup for which PRED returns true. The + ;; order in which writers are added matters (it should be the same as the + ;; lookup order), hence the use of `append' below. (define (check-procedure name proc arity) (cond @@ -359,9 +361,10 @@ otherwise the requested engine is returned." (if (symbol? ident) (let ((writers (slot-ref e 'writers))) (hashq-set! writers ident - (cons n (hashq-ref writers ident '())))) + (append (hashq-ref writers ident '()) + (list n)))) (slot-set! e 'free-writers - (cons n (slot-ref e 'free-writers)))) + (append (slot-ref e 'free-writers) (list n)))) n)) diff --git a/src/guile/skribilo/writer.scm b/src/guile/skribilo/writer.scm index b46cddc..4750e57 100644 --- a/src/guile/skribilo/writer.scm +++ b/src/guile/skribilo/writer.scm @@ -163,7 +163,8 @@ (define (lookup-markup-writer node e) ;; Find the writer that applies best to NODE. See also `markup-writer-get' - ;; and `markup-writer-get*'. + ;; and `markup-writer-get*'. Writers are looked up in the order in which + ;; they were registered. (define (matching-writer writers) (find (lambda (w) -- cgit v1.2.3