lilypond-user
[Top][All Lists]
Advanced

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

Re: Guile library function availability


From: Lukas-Fabian Moser
Subject: Re: Guile library function availability
Date: Mon, 24 May 2021 20:00:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

Hi Jean,

I never understood the whole thing fully (and it is at the heart of the problem that led to disabling LilyPond on WikiMedia), but output definitions have their own scope, which is implemented as a Guile module. pretty-print is defined by another Guile module, (ice-9 pretty-print), which is generally available in LilyPond code because it is loaded upon initialization of LilyPond (see init.ly). last is in (srfi srfi-1), which is also loaded by default.

If you want these functions in a \layout, you have to load the corresponding module by hand:

\layout {
  #(use-modules (ice-9 pretty-print))
  \override NoteHead.after-line-breaking =
  #(lambda (grob) (pretty-print "I explode."))
}

{
  a4
}

Thanks much for the explanation and the pointers to workarounds!

That's the kind of pitfall that lets you start doubting your sanity: You create and test a scheme \override, and when it finally works, you copy it into a general-purpose definition of a new context ... and it stops working (with the strange error message that "last" is an unknown variable). :-)

At least now I understand why I sometimes see (car (last-pair some-list)) in examples where I'd usually expect (last some-list).

Lukas



reply via email to

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