Re: [GSoC] Proposal: Modular LilyPond Parser (C++)

Lukas-Fabian Moser <[email protected]> Tue, 17 Mar 2026 16:14:13 +0100
Newsgroups gmane.comp.gnu.lilypond.devel
Message-ID <[email protected]>
> That’s not how defining music functions works. (Also, I don’t know 
> what \original-clef is supposed to be…)
>
> Try the example below.
>
> Best, Simon
>
> \version "2.25.34"
>
> schluessel = #(define-music-function (name) (string?)
>    (clef name))
> schluesseli = \clef \etc
>
> \score {
>   \new Staff {
>     \schluessel "alto"
>     g'1
>     \schluesseli "tenor"
>     1
>   }
> } 

Or, to stay as close as possible to the definition that Christian tried:

\version "2.27.0"

original-clef = #clef

clef =
#(define-music-function (name) (string?)
    (ly:message "Re-defined clef function called!")
    #{
      \original-clef #name
    #})

{
   \clef alto
   a2
}

Lukas