lilypond-user
[Top][All Lists]
Advanced

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

Re: Define an alias to a parametrized command


From: David Kastrup
Subject: Re: Define an alias to a parametrized command
Date: Tue, 27 Jun 2023 23:23:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Leo Correia de Verdier <leo.correia.de.verdier@gmail.com> writes:

>> 27 juni 2023 kl. 21:57 skrev Volodymyr Prokopyuk
>> <volodymyrprokopyuk@gmail.com>:
>> 
>> I'd like to define a shorter alias to a parametrized command. My two
>> specific use cases are
>>      • Define \acc { c='8 d e } to be translated into \acciaccatura
>> { c='8 d e }
>>      • Define \af 4. to be translated into \after 4.\!
>> I've tried the \set command, but it seems that the \set command does
>> not handle parameters. I have an intuitive understanding that this
>> type of aliases can be done with Scheme, but I do not know how
>> exactly.

> You can write:
> %%%%%%%%%%%%%
> acc = \acciaccatura \etc
> af = \after \etc
> %%%%%%%%%%%%%
>
> \set in lilypond  is something completely else.

This definition of \af does not have the specified semantics.  Instead
you need to write

af = #(define-music-function (dur mus) (ly:duration?) (ly:music?)
            #{ \after #dur \! #mus #})

-- 
David Kastrup



reply via email to

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