lilypond-user
[Top][All Lists]
Advanced

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

Re: top-level markup in Scheme


From: Jean Abou Samra
Subject: Re: top-level markup in Scheme
Date: Fri, 13 May 2022 18:19:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

Le 13/05/2022 à 15:30, Valentin Petzel a écrit :
Hello Werner,

if you intend to create Markup- or Score-Section from Scheme you might want to 
directly invoke (add-text some-markup) and (add-score some-score). This would 
allow you to cleanly handle stuff like inserting multiple markups and scores at 
the same time from a bit of scheme code.

Inserting a top level score or markup calls the top-level-score/markup-handler, 
which defaults to doing the same thing.



That would work too. Note, though, that $ is not restricted to
inserting a single markup or score at a time.

$(values (make-bold-markup "a") (make-italic-markup "a"))

Equivalently, this spelling may be easier to grasp for those
not familiar with Scheme's multiple values feature:

$@(list (make-bold-markup "a") (make-italic-markup "a"))

It is true, however, that you cannot do this from syntax functions.
I actually created an issue about that not long ago:

https://gitlab.com/lilypond/lilypond/-/issues/6333

So, I prefer the $ spelling, which is probably a matter of taste
(my reasons are: it's documented, it doesn't work via a side effect,
and some bad gut feelings about the current design of handlers). On
the other hand, it is a bit less powerful in the current state of
things. Also, it may (rarely) cause surprises due to lookahead, like

myA = "a"
$myA

which does not work, although this does:

myA = "a"
\void dummy
$myA


Jean




reply via email to

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