lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: book-predicate


From: Jan-Peter Voigt
Subject: Re: book-predicate
Date: Fri, 02 Mar 2012 17:07:50 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.26) Gecko/20120131 Thunderbird/3.1.18

On 02.03.2012 10:30, David Kastrup wrote:
Jan-Peter Voigt<address@hidden>  writes:

Hello David, hello lists,

now, when we have a book-predicate, we are dealing with books in
scheme. And then we might want to set a header after creating a book.
There is a function ly:score-set-header!, which I copied and adapted
for the Book-class.
This patch compiled and works with the following snippet.

--snip--
\version "2.15.32"

bk = \book {
   \score {
     \relative c' {
       c4 e g b
     }
   }
}

#(let ((bh (eval-string "(define-module (a b))")))
      (eval '(define title "Hallo") bh)
      (ly:book-set-header! bk bh))
"eval-string" is not exactly what I call "in Scheme".

\book { \bk }
--snip--

Is this helpful for lily-devel?
And is there another (better) way of creating a module (for header
generation) on the fly in scheme?
make-module would be obvious.
But if you try a (eval '(define title "Titel") (make-module)) it fails with "Unbound variable: define"?
But you could write the above just as

bk = \book {
   \score {
     \relative c' {
       c4 e g b
     }
   }
}

#(define bk #{ \book { \bk \header { title = "Hallo" } } #})

\book { \bk }

It is a bit of cheating since it works on a copy of the book, but not
all that much.

Yes, that would work, but if I have a function (set-book-headers! book head-a-list) I want to modify the header of the actual book. I am working on my methods to create books with common style but without too much copy&paste.

Thanks for your answer and have nice weekend!
Cheers,
Jan-Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]