[Top][All Lists]

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

Re: Music-function "arguments" - help

From: Urs Liska
Subject: Re: Music-function "arguments" - help
Date: Fri, 7 Dec 2018 11:23:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Am 07.12.18 um 11:07 schrieb Urs Liska:

Am 07.12.18 um 10:55 schrieb mansouraoun:
i wrote the code in raw and it's somehow not displayed in my message
Here it is

dynx =
      (parser location X-offset)
      \once\override DynamicText.X-offset = #X-offset


As David said: if you use the development version (currently 2.19.82) you can simplify this by skipping "parser location":

  #(define-music-function (X-offset)(number?)

And while we're at it:

As David also pointed out, the *naming* of such variables is arbitrary, it's just their order/position. "parser" and "location" are arguments that the LilyPond parser (in 2.18) *implicitly* passes to a music function because *sometimes* a music function has the need to access either the current LilyPond parser or the "location" (the place in the input file from where the function was called). But since the vast majority of functions does *not* need them it is needlessly verbose having to write them for each and every music function. So two procedures, *parser* and *location* were at some point added to LilyPond that can be called from within a music function, if it should actually need one of these values (to *invoke* a procedure it has to be enclosed in parentheses like

  (display (*location*))

For the function you are currently interested in this is of absolutely no interest, but I thought to point it out since you were irritated by the function arguments in the first place, so it may be interesting to know.



lilypond-user mailing list

reply via email to

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