lilypond-user
[Top][All Lists]
Advanced

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

Re: /etc shortcut


From: Stephan Schöll
Subject: Re: /etc shortcut
Date: Sun, 1 May 2022 21:49:32 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

ha, with german browser settings and calling
https://lilypond.org/doc/v2.23/Documentation/notation/substitution-function-examples
I get content, but with chapter number 5.6.2 AND: nothing about the \etc
shortcut on the page.

Am 01.05.2022 um 21:46 schrieb Stephan Schöll:
Be aware that the documentation looks very different depending on the
language headers the brower hands over to the documentation web server!
Based in Switzerland according to my default browser settings I get the
german documentation. And this documentation differs very much from the
english version in section 3 in general. And section 3.4 is definitively
different in content, 3.4.3. even doesn't exist. Not surprising that I
didn't find anything in the docs... The same browser language-specific
behaviour happens also in the command index
https://lilypond.org/doc/v2.23/Documentation/notation/lilypond-command-index

: In the german version no entry for \etc exists.

In both cases I am looking at the 2.23.8 dev branch documentation.


Am 30.04.2022 um 23:17 schrieb Jean Abou Samra:
Le 30/04/2022 à 22:44, Stephan Schöll a écrit :
Hi everybody

A few days ago Lukas-Fabian has pointed me to the existence of the /etc
shortcut. It seems to me that this would easy a lot of everday work
without any further Scheme skills (music-function-... ). Unfortunately
the /etc shortcut is not mentionned in the official docs. The only
information I could find is at
https://extending-lilypond.readthedocs.io/en/latest/music.html#the-etc-shortcut





I'm glad that this resource is showing usefulness. On the other
hand, \etc *is* mentioned in the official docs. Look in the function
index:

https://lilypond.org/doc/v2.23/Documentation/notation/lilypond-command-index



You will find two pages (briefly) explaining its use, one in music
functions and one in markup commands. (The one for markup commands was
added in the 2.23 documentation.)



I tried to create an mve for myself but failed:

boxedMark = \mark \markup { \box \etc }

{

  c1 d \boxedMark "Part II" e f

}

My current (but appearently failing) mental model is that /etc is a
kind
of function parameter - here called with value "Part II". (I know how
procedural and oo languages work.) boxedMark is my function, and with
the \etc parameter I am able to pass my value o the functions body.



Well, \etc is not as general as this. For one thing, it works
as a trailing argument. You can have

shortcut = \function a b \etc

but not

shortcut = \function \etc a b

Basically, you should think of \etc as "cutting short" the application
of the function and leaving the remaining arguments to be given
"another time". (Hence its name.)

Also, even if you spell it as \mark \markup \box \etc (without braces),
it still does not work, because \etc cannot mix music and markup
contexts.
\mark is a music function. It won't like receiving a partial markup
command.

Thus, in this case, you should revert to a plain old music function
instead:

boxedMark =
#(define-music-function (arg) (markup?)
   #{ \mark \markup \box #arg #})


Note how, by using #{ #} syntax, you can write such functions
without any knowledge of Scheme apart from the names of the
type predicates. The manual calls this "substitution functions",
explained at

https://lilypond.org/doc/v2.23/Documentation/notation/substitution-function-syntax



Type predicates are listed at
https://lilypond.org/doc/v2.23/Documentation/notation/predefined-type-predicates



Best regards,
Jean






reply via email to

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