lilypond-user
[Top][All Lists]
Advanced

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

Re: Making markup functions parametric


From: David Kastrup
Subject: Re: Making markup functions parametric
Date: Sat, 04 Jul 2020 17:06:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lukas-Fabian Moser <lfm@gmx.de> writes:

>>> Of course I can do
>>>
>>> circlefunc = \markup\circle\etc
>>> \markup \test \circlefunc "whatever"
>> You can?  Have you tried?  \circlefunc here is quite equivalent to
>> \circle .
>
> Hm, I think I do not understand. With
>
> test =
> #(define-scheme-function (enclosure content)
>    (markup-function? markup?)
>    (list enclosure #{ \markup \box #content #}))
>
> I can do and compile
>
> \test \markup \circle \etc "whatever"
>
> as well as
>
> circlefunc = \markup\circle\etc
> \markup \test \circlefunc "whatever"
>
> but
>
> \markup \test \circle "whatever"
>
> fails with
>
> /tmp/frescobaldi-7l5ntq0c/tmp1iduvtxw/document.ly:8:15: Fehler: syntax
> error, unexpected MARKUP_FUNCTION, expecting \header
>
> \markup \test
>
> \circle "whatever"
>
> /tmp/frescobaldi-7l5ntq0c/tmp1iduvtxw/document.ly:8:33: Fehler:
> Haupt-Eingabe nicht beendet
>
> \markup \test \circle "whatever"
>
> schwerer Fehler: gescheiterte Dateien:
> "/tmp/frescobaldi-7l5ntq0c/tmp1iduvtxw/document.ly"
>
> So, I can't believe that \circlefunc and \circle should be actually
> equivalent.

Ah right, there is a difference.  They would be equivalent when writing

\markup circlefunc = \markup \circle \etc

The actually embedded markup function is the same, but it is packaged
differently.  You can get at the markup function part of the package by
using

test =
#(define-scheme-function (enclosure content)
  (markup-function? markup?)
  (list enclosure #{ \markup \box #content #}))

\markup \test \circle-markup "whatever"

Markups and their commands are an abomination.

-- 
David Kastrup

reply via email to

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