Hello list,

here's my approach to inherit the input-location in nested music-functions:

--snip--

\version "2.15.40"

% a test function, which simply outputs the location

test = #(define-music-function (parser location mus)(ly:music?)

(ly:input-message location "~A" location) mus)

% a scheme-function to execute a music-function with a specific location argument

#(define-public (ly:music-function-exec fun parser location . args)

(apply (ly:music-function-extract fun) parser location args))

% a nested music-function

fun = #(define-music-function (parser location mus)(ly:music?)

#{

$(ly:music-function-exec test parser location mus)

#})

% example

\new Staff {

% this will output this location, *not* the location _inside_ of the fun function

\fun \relative c'' {

c des ees

}

}

--snip--

This is helpful, if nested music-function-calls output warnings or other ly:input-message's. I use contructs like this (for example) to nest the \shape command and calculate the needed offset parameters from "easier" values.

Cheers, Jan-Peter


_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to