lilypond-user
[Top][All Lists]
Advanced

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

Temporary change to macro definition


From: Jérôme Plût
Subject: Temporary change to macro definition
Date: Tue, 4 Aug 2015 22:26:50 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

In the attached file, I made a macro \count such that
a^\count a^\count a^\count is understood as a^"1" a^"2" a^"3"...

I also wrote a macro \repeatWithCount such that
\repeatWithCount 3 { a^\acount } also evaluates to a^"1" a^"2" a^"3".

However, (for aesthetic reasons!) I would prefer to use \count in both
situations. Is it possible to modify the \repeatWithCount function so
that it basically says
(set! count count-auto)
(do the \repeatWithCount work)
(set! count count-manual)
 ?

If I directly define
repeatWithCount = #(define-music-function (parser location n music) ...)
then the 'music' parameter is evaluated before repeatWithCount gets
its chance to redefine \count. If this were TeX, I could say something like

\def\repeatWithCount{\def\count\countAuto \RealRepeatWithCount}
\def\RealRepeatWithCount#1#2{ % do the work, then
  \def\count\countManual}

However, trying something like this (i.e. returning
#{ \RealRepeatWithoutCount #}) does not work in Lilypond. Is there a
way to do this?

Thanks,

-- 
        Jérôme

Attachment: b.ly
Description: Text Data


reply via email to

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