]> git.donarmstrong.com Git - lilypond.git/blob - ly/music-functions-init.ly
Merge branch 'translation' into staging
[lilypond.git] / ly / music-functions-init.ly
1 %%%% -*- Mode: Scheme -*-
2
3 %%%% This file is part of LilyPond, the GNU music typesetter.
4 %%%%
5 %%%% Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 %%%%                          Jan Nieuwenhuizen <janneke@gnu.org>
7 %%%%
8 %%%% LilyPond is free software: you can redistribute it and/or modify
9 %%%% it under the terms of the GNU General Public License as published by
10 %%%% the Free Software Foundation, either version 3 of the License, or
11 %%%% (at your option) any later version.
12 %%%%
13 %%%% LilyPond is distributed in the hope that it will be useful,
14 %%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
15 %%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 %%%% GNU General Public License for more details.
17 %%%%
18 %%%% You should have received a copy of the GNU General Public License
19 %%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
20
21 \version "2.15.18"
22
23
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 %% this file is alphabetically sorted.
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28 %% need SRFI-1 for filter; optargs for lambda*
29 #(use-modules (srfi srfi-1)
30               (ice-9 optargs))
31
32 %% TODO: using define-music-function in a .scm causes crash.
33
34 acciaccatura =
35 #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic
36    (_i "Create an acciaccatura from the following music expression"))
37
38 %% keep these two together
39 "instrument-definitions" = #'()
40 addInstrumentDefinition =
41 #(define-void-function
42    (parser location name lst) (string? list?)
43    (_i "Create instrument @var{name} with properties @var{list}.")
44    (set! instrument-definitions (acons name lst instrument-definitions)))
45
46 addQuote =
47 #(define-void-function (parser location name music) (string? ly:music?)
48    (_i "Define @var{music} as a quotable music expression named
49 @var{name}")
50    (add-quotable parser name music))
51
52 %% keep these two together
53 afterGraceFraction = #(cons 6 8)
54 afterGrace =
55 #(define-music-function (parser location main grace) (ly:music? ly:music?)
56    (_i "Create @var{grace} note(s) after a @var{main} music expression.")
57    (let ((main-length (ly:music-length main))
58          (fraction  (ly:parser-lookup parser 'afterGraceFraction)))
59      (make-simultaneous-music
60       (list
61        main
62        (make-sequential-music
63         (list
64
65          (make-music 'SkipMusic
66                      'duration (ly:make-duration
67                                 0 0
68                                 (* (ly:moment-main-numerator main-length)
69                                    (car fraction))
70                                 (* (ly:moment-main-denominator main-length)
71                                    (cdr fraction))))
72          (make-music 'GraceMusic
73                      'element grace)))))))
74
75
76 %% music identifiers not allowed at top-level,
77 %% so this is a music-function instead.
78 allowPageTurn =
79 #(define-music-function (location parser) ()
80    (_i "Allow a page turn. May be used at toplevel (ie between scores or
81 markups), or inside a score.")
82    (make-music 'EventChord
83                'page-marker #t
84                'page-turn-permission 'allow
85                'elements (list (make-music 'PageTurnEvent
86                                            'break-permission 'allow))))
87
88 alterBroken =
89 #(define-music-function (parser location name property arg)
90   (string? scheme? list?)
91   (_i "Override @var{property} for pieces of broken spanner @var{name} with
92 values @var{arg}.")
93   (let* ((name (string-delete name char-set:blank)) ; remove any spaces
94          (name-components (string-split name #\.))
95          (context-name "Bottom")
96          (grob-name #f))
97
98     (if (> 2 (length name-components))
99         (set! grob-name (car name-components))
100         (begin
101           (set! grob-name (cadr name-components))
102           (set! context-name (car name-components))))
103
104     ;; only apply override if grob is a spanner
105     (let ((description
106             (assoc-get (string->symbol grob-name) all-grob-descriptions)))
107       (if (and description
108                (member 'spanner-interface
109                        (assoc-get 'interfaces
110                                   (assoc-get 'meta description))))
111           #{
112             \override $context-name . $grob-name $property =
113               #(value-for-spanner-piece arg)
114           #}
115           (begin
116             (ly:input-warning location (_ "not a spanner name, `~a'") grob-name)
117             (make-music 'SequentialMusic 'void #t))))))
118
119 appendToTag =
120 #(define-music-function (parser location tag more music)
121    (symbol? ly:music? ly:music?)
122    (_i "Append @var{more} to the @code{elements} of all music
123 expressions in @var{music} that are tagged with @var{tag}.")
124    (music-map (lambda (m)
125                 (if (memq tag (ly:music-property m 'tags))
126                     (set! (ly:music-property m 'elements)
127                           (append (ly:music-property m 'elements)
128                                   (list more))))
129                 m)
130               music))
131
132 applyContext =
133 #(define-music-function (parser location proc) (procedure?)
134    (_i "Modify context properties with Scheme procedure @var{proc}.")
135    (make-music 'ApplyContext
136                'procedure proc))
137
138 applyMusic =
139 #(define-music-function (parser location func music) (procedure? ly:music?)
140    (_i"Apply procedure @var{func} to @var{music}.")
141    (func music))
142
143 applyOutput =
144 #(define-music-function (parser location ctx proc) (symbol? procedure?)
145    (_i "Apply function @code{proc} to every layout object in context @code{ctx}")
146    (make-music 'ApplyOutputEvent
147                'procedure proc
148                'context-type ctx))
149
150 appoggiatura =
151 #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic
152    (_i "Create an appoggiatura from @var{music}"))
153
154 % for regression testing purposes.
155 assertBeamQuant =
156 #(define-music-function (parser location l r) (pair? pair?)
157    (_i "Testing function: check whether the beam quants @var{l} and @var{r} are correct")
158    (make-grob-property-override 'Beam 'positions (check-quant-callbacks l r)))
159
160 % for regression testing purposes.
161 assertBeamSlope =
162 #(define-music-function (parser location comp) (procedure?)
163    (_i "Testing function: check whether the slope of the beam is the same as @code{comp}")
164    (make-grob-property-override 'Beam 'positions (check-slope-callbacks comp)))
165
166 autochange =
167 #(define-music-function (parser location music) (ly:music?)
168    (_i "Make voices that switch between staves automatically")
169    (make-autochange-music parser music))
170
171
172
173 balloonGrobText =
174 #(define-music-function (parser location grob-name offset text)
175    (symbol? number-pair? markup?)
176    (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
177  (use like @code{\\once})")
178    (make-music 'AnnotateOutputEvent
179                'symbol grob-name
180                'X-offset (car offset)
181                'Y-offset (cdr offset)
182                'text text))
183
184 balloonText =
185 #(define-music-function (parser location offset text) (number-pair? markup?)
186    (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
187    (make-music 'AnnotateOutputEvent
188                'X-offset (car offset)
189                'Y-offset (cdr offset)
190                'text text))
191
192 bar =
193 #(define-music-function (parser location type) (string?)
194    (_i "Insert a bar line of type @var{type}")
195    (context-spec-music
196     (make-property-set 'whichBar type)
197     'Timing))
198
199 barNumberCheck =
200 #(define-music-function (parser location n) (integer?)
201    (_i "Print a warning if the current bar number is not @var{n}.")
202    (make-music 'ApplyContext
203                'procedure
204                (lambda (c)
205                  (let ((cbn (ly:context-property c 'currentBarNumber)))
206                    (if (and  (number? cbn) (not (= cbn n)))
207                        (ly:input-warning location
208                                          "Barcheck failed got ~a expect ~a"
209                                          cbn n))))))
210
211 bendAfter =
212 #(define-event-function (parser location delta) (real?)
213    (_i "Create a fall or doit of pitch interval @var{delta}.")
214    (make-music 'BendAfterEvent
215                'delta-step delta))
216
217 bookOutputName =
218 #(define-void-function (parser location newfilename) (string?)
219    (_i "Direct output for the current book block to @var{newfilename}.")
220    (set! (paper-variable parser #f 'output-filename) newfilename))
221
222 bookOutputSuffix =
223 #(define-void-function (parser location newsuffix) (string?)
224    (_i "Set the output filename suffix for the current book block to
225 @var{newsuffix}.")
226    (set! (paper-variable parser #f 'output-suffix) newsuffix))
227
228 %% \breathe is defined as a music function rather than an event identifier to
229 %% ensure it gets useful input location information: as an event identifier,
230 %% it would have to be wrapped in an EventChord to prevent it from being
231 %% treated as a post_event by the parser
232 breathe =
233 #(define-music-function (parser location) ()
234    (_i "Insert a breath mark.")
235    (make-music 'BreathingEvent))
236
237 clef =
238 #(define-music-function (parser location type) (string?)
239    (_i "Set the current clef to @var{type}.")
240    (make-clef-set type))
241
242
243 compoundMeter =
244 #(define-music-function (parser location args) (pair?)
245   (_i "Create compound time signatures. The argument is a Scheme list of
246 lists. Each list describes one fraction, with the last entry being the
247 denominator, while the first entries describe the summands in the
248 enumerator. If the time signature consists of just one fraction,
249 the list can be given directly, i.e. not as a list containing a single list.
250 For example, a time signature of (3+1)/8 + 2/4 would be created as
251 @code{\\compoundMeter #'((3 1 8) (2 4))}, and a time signature of (3+2)/8
252 as @code{\\compoundMeter #'((3 2 8))} or shorter
253 @code{\\compoundMeter #'(3 2 8)}.")
254   (let* ((mlen (calculate-compound-measure-length args))
255          (beat (calculate-compound-base-beat args))
256          (beatGrouping (calculate-compound-beat-grouping args))
257          (timesig (cons (ly:moment-main-numerator mlen)
258                         (ly:moment-main-denominator mlen))))
259   #{
260     \once \override Staff.TimeSignature #'stencil = #(lambda (grob)
261       (grob-interpret-markup grob (format-compound-time args)))
262     \set Timing.timeSignatureFraction = $timesig
263     \set Timing.baseMoment = $beat
264     \set Timing.beatStructure = $beatGrouping
265     \set Timing.beamExceptions = #'()
266     \set Timing.measureLength = $mlen
267   #} ))
268
269 crossStaff =
270 #(define-music-function (parser location notes) (ly:music?)
271   (_i "Create cross-staff stems")
272   #{
273   \override Stem #'cross-staff = #cross-staff-connect
274   \override Flag #'style = #'no-flag
275   $notes
276   \revert Stem #'cross-staff
277   \revert Flag #'style
278 #})
279
280 cueClef =
281 #(define-music-function (parser location type) (string?)
282   (_i "Set the current cue clef to @var{type}.")
283   (make-cue-clef-set type))
284
285 cueClefUnset =
286 #(define-music-function (parser location) ()
287   (_i "Unset the current cue clef.")
288   (make-cue-clef-unset))
289
290 cueDuring =
291 #(define-music-function
292    (parser location what dir main-music) (string? ly:dir? ly:music?)
293    (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
294 in a CueVoice oriented by @var{dir}.")
295    (make-music 'QuoteMusic
296                'element main-music
297                'quoted-context-type 'Voice
298                'quoted-context-id "cue"
299                'quoted-music-name what
300                'quoted-voice-direction dir))
301
302 cueDuringWithClef =
303 #(define-music-function
304    (parser location what dir clef main-music) (string? ly:dir? string? ly:music?)
305    (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
306 in a CueVoice oriented by @var{dir}.")
307    (make-music 'QuoteMusic
308                'element main-music
309                'quoted-context-type 'Voice
310                'quoted-context-id "cue"
311                'quoted-music-name what
312                'quoted-music-clef clef
313                'quoted-voice-direction dir))
314
315
316
317 displayLilyMusic =
318 #(define-music-function (parser location music) (ly:music?)
319    (_i "Display the LilyPond input representation of @var{music}
320 to the console.")
321    (newline)
322    (display-lily-music music parser)
323    music)
324
325 displayMusic =
326 #(define-music-function (parser location music) (ly:music?)
327    (_i "Display the internal representation of @var{music} to the console.")
328    (newline)
329    (display-scheme-music music)
330    music)
331
332
333
334 endSpanners =
335 #(define-music-function (parser location music) (ly:music?)
336    (_i "Terminate the next spanner prematurely after exactly one note
337 without the need of a specific end spanner.")
338    (if (memq (ly:music-property music 'name) '(EventChord NoteEvent))
339        (let* ((start-span-evs (filter (lambda (ev)
340                                         (equal? (ly:music-property ev 'span-direction)
341                                                 START))
342                                       (extract-typed-music music 'span-event)))
343               (stop-span-evs
344                (map (lambda (m)
345                       (let ((c (music-clone m)))
346                         (set! (ly:music-property c 'span-direction) STOP)
347                         c))
348                     start-span-evs))
349               (end-ev-chord (make-music 'EventChord
350                                         'elements stop-span-evs))
351               (total (make-music 'SequentialMusic
352                                  'elements (list music
353                                                  end-ev-chord))))
354          total)
355
356        (begin
357          (ly:input-message location (_ "argument endSpanners is not an EventChord: ~a") music)
358          music)))
359
360 eventChords =
361 #(define-music-function (parser location music) (ly:music?)
362    (_i "Compatibility function wrapping @code{EventChord} around
363 isolated rhythmic events occuring since version 2.15.28, after
364 expanding repeat chords @samp{q}.")
365    (event-chord-wrap! music parser))
366
367 featherDurations=
368 #(define-music-function (parser location factor argument) (ly:moment? ly:music?)
369    (_i "Adjust durations of music in @var{argument} by rational @var{factor}.")
370    (let ((orig-duration (ly:music-length argument))
371          (multiplier (ly:make-moment 1 1)))
372
373      (for-each
374       (lambda (mus)
375         (if (< 0 (ly:moment-main-denominator (ly:music-length mus)))
376             (begin
377               (ly:music-compress mus multiplier)
378               (set! multiplier (ly:moment-mul factor multiplier)))))
379       (extract-named-music argument '(EventChord NoteEvent RestEvent SkipEvent)))
380      (ly:music-compress
381       argument
382       (ly:moment-div orig-duration (ly:music-length argument)))
383
384      argument))
385
386 footnote =
387 #(define-music-function (parser location mark offset grob-name footnote music)
388    ((markup?) number-pair? (symbol?) markup? (ly:music?))
389    (_i "Make the markup @var{footnote} a footnote on @var{music}.  The
390 footnote is marked with a markup @var{mark} moved by @var{offset} with
391 respect to the marked music.
392
393 If @var{mark} is not given or specified as @var{\\default}, it is
394 replaced by an automatically generated sequence number.  If a symbol
395 @var{grob-name} is specified, then grobs of that type will be marked
396 if they have @var{music} as their ultimate cause; by default all grobs
397 having @var{music} as their @emph{direct} cause will be marked,
398 similar to the way @code{\\tweak} works.
399
400 If @var{music} is given as @code{\\default}, a footnote event
401 affecting @emph{all} grobs matching @var{grob-name} at a given time
402 step is generated.  This may be required for creating footnotes on
403 time signatures, clefs, and other items not cooperating with
404 @code{\\tweak}.
405
406 Like with @code{\\tweak}, if you use a footnote on a following
407 post-event, the @code{\\footnote} command itself needs to be attached
408 to the preceding note or rest as a post-event with @code{-}.")
409    (let ((mus (make-music
410                'FootnoteEvent
411                'X-offset (car offset)
412                'Y-offset (cdr offset)
413                'automatically-numbered (not mark)
414                'text (or mark (make-null-markup))
415                'footnote-text footnote
416                'symbol (or grob-name '()))))
417      (cond (music
418             (set! (ly:music-property music 'tweaks)
419                   (acons (if grob-name
420                              (cons grob-name 'footnote-music)
421                              'footnote-music)
422                          mus
423                          (ly:music-property music 'tweaks)))
424             music)
425            (grob-name mus)
426            (else
427             (ly:input-warning location
428                               (_ "\\footnote requires music or grob-name"))
429             (make-music 'Music)))))
430
431 grace =
432 #(def-grace-function startGraceMusic stopGraceMusic
433    (_i "Insert @var{music} as grace notes."))
434
435 grobdescriptions =
436 #(define-scheme-function (parser location descriptions) (list?)
437    (_i "Create a context modification from @var{descriptions}, a list
438 in the format of @code{all-grob-descriptions}.")
439    (ly:make-context-mod
440     (map (lambda (p)
441            (list 'assign (car p) (list (cdr p))))
442          descriptions)))
443
444 harmonicByFret = #(define-music-function (parser location fret music) (number? ly:music?)
445   (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
446 harmonics played on a fretted instrument by touching the strings at @var{fret}.")
447   #{
448     \set harmonicDots = ##t
449     \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label (number->string fret))
450     \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container ly:grob::stencil-height
451                                        (lambda (grob start end)
452                                                (ly:grob::stencil-height grob)))
453     \override NoteHead #'stencil = #(lambda (grob) (ly:grob-set-property! grob 'style 'harmonic-mixed)
454                                             (ly:note-head::print grob))
455     $(make-harmonic
456        (calc-harmonic-pitch (fret->pitch (number->string fret)) music))
457     \unset harmonicDots
458     \revert TabNoteHead #'stencil
459     \revert NoteHead #'Y-extent
460     \revert NoteHead #'stencil
461   #})
462
463 harmonicByRatio = #(define-music-function (parser location ratio music) (number? ly:music?)
464     (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
465 harmonics played on a fretted instrument by touching the strings at the point
466 given through @var{ratio}.")
467   #{
468     \set harmonicDots = ##t
469     \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label (ratio->fret ratio))
470     \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container ly:grob::stencil-height
471                                        (lambda (grob start end)
472                                                (ly:grob::stencil-height grob)))
473     \override NoteHead #'stencil = #(lambda (grob) (ly:grob-set-property! grob 'style 'harmonic-mixed)
474                                             (ly:note-head::print grob))
475     $(make-harmonic
476       (calc-harmonic-pitch (ratio->pitch ratio) music))
477     \unset harmonicDots
478     \revert TabNoteHead #'stencil
479     \revert NoteHead #'Y-extent
480     \revert NoteHead #'stencil
481   #})
482
483 inStaffSegno =
484 #(define-music-function (parser location) ()
485    (_i "Put the segno variant 'varsegno' at this position into the staff,
486 compatible with the repeat command.")
487    (make-music 'ApplyContext
488                'procedure
489                (lambda (ctx)
490                  (let ((score-ctx (ly:context-find ctx 'Score)))
491                    (if (ly:context? score-ctx)
492                      (let ((old-rc (ly:context-property score-ctx 'repeatCommands '())))
493                        (if (eq? (memq 'segno-display old-rc) #f)
494                          (ly:context-set-property! score-ctx 'repeatCommands (cons 'segno-display old-rc)))))))))
495
496 instrumentSwitch =
497 #(define-music-function
498    (parser location name) (string?)
499    (_i "Switch instrument to @var{name}, which must be predefined with
500 @code{\\addInstrumentDefinition}.")
501    (let* ((handle (assoc name instrument-definitions))
502           (instrument-def (if handle (cdr handle) '())))
503
504      (if (not handle)
505          (ly:input-warning location "No such instrument: ~a" name))
506      (context-spec-music
507       (make-music 'SimultaneousMusic
508                   'elements
509                   (map (lambda (kv)
510                          (make-property-set
511                           (car kv)
512                           (cdr kv)))
513                        instrument-def))
514       'Staff)))
515
516
517
518 keepWithTag =
519 #(define-music-function (parser location tag music) (symbol? ly:music?)
520    (_i "Include only elements of @var{music} that are tagged with @var{tag}.")
521    (music-filter
522     (lambda (m)
523       (let* ((tags (ly:music-property m 'tags))
524              (res (memq tag tags)))
525         (or
526          (eq? tags '())
527          res)))
528     music))
529
530 key =
531 #(define-music-function (parser location tonic pitch-alist)
532    ((ly:pitch? '()) (list? '()))
533    (_i "Set key to @var{tonic} and scale @var{pitch-alist}.
534 If both are null, just generate @code{KeyChangeEvent}.")
535    (cond ((null? tonic) (make-music 'KeyChangeEvent))
536          ((null? pitch-alist)
537           (ly:parser-error parser (_ "second argument must be pitch list")
538                            location)
539           (make-music 'SequentialMusic 'void #t))
540          (else
541           (ly:music-transpose
542            (make-music 'KeyChangeEvent
543                 'tonic (ly:make-pitch 0 0 0)
544                 'pitch-alist pitch-alist)
545            tonic))))
546
547 killCues =
548 #(define-music-function (parser location music) (ly:music?)
549    (_i "Remove cue notes from @var{music}.")
550    (music-map
551     (lambda (mus)
552       (if (and (string? (ly:music-property mus 'quoted-music-name))
553                (string=? (ly:music-property mus 'quoted-context-id "") "cue"))
554           (ly:music-property mus 'element)
555           mus))
556     music))
557
558
559
560 label =
561 #(define-music-function (parser location label) (symbol?)
562    (_i "Create @var{label} as a bookmarking label.")
563    (make-music 'EventChord
564                'page-marker #t
565                'page-label label
566                'elements (list (make-music 'LabelEvent
567                                            'page-label label))))
568
569
570 language =
571 #(define-void-function (parser location language) (string?)
572    (_i "Set note names for language @var{language}.")
573    (note-names-language parser language))
574
575 languageSaveAndChange =
576 #(define-void-function (parser location language) (string?)
577   (_i "Store the previous pitchnames alist, and set a new one.")
578   (set! previous-pitchnames pitchnames)
579   (note-names-language parser language))
580
581 languageRestore =
582 #(define-void-function (parser location) ()
583    (_i "Restore a previously-saved pitchnames alist.")
584    (if previous-pitchnames
585        (begin
586         (set! pitchnames previous-pitchnames)
587         (ly:parser-set-note-names parser pitchnames))
588       (ly:input-warning location (_ "No other language was defined previously. Ignoring."))))
589
590
591 makeClusters =
592 #(define-music-function (parser location arg) (ly:music?)
593    (_i "Display chords in @var{arg} as clusters.")
594    (music-map note-to-cluster arg))
595
596 modalInversion =
597 #(define-music-function (parser location around to scale music)
598     (ly:pitch? ly:pitch? ly:music? ly:music?)
599     (_i "Invert @var{music} about @var{around} using @var{scale} and
600 transpose from @var{around} to @var{to}.")
601     (let ((inverter (make-modal-inverter around to scale)))
602       (change-pitches music inverter)
603       music))
604
605 modalTranspose =
606 #(define-music-function (parser location from to scale music)
607     (ly:pitch? ly:pitch? ly:music? ly:music?)
608     (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}
609 using @var{scale}.")
610     (let ((transposer (make-modal-transposer from to scale)))
611       (change-pitches music transposer)
612       music))
613
614 inversion =
615 #(define-music-function
616    (parser location around to music) (ly:pitch? ly:pitch? ly:music?)
617    (_i "Invert @var{music} about @var{around} and
618 transpose from @var{around} to @var{to}.")
619    (music-invert around to music))
620
621 mark =
622 #(define-music-function
623    (parser location label) ((scheme? '()))
624   "Make the music for the \\mark command."
625   (let* ((set (and (integer? label)
626                    (context-spec-music (make-property-set 'rehearsalMark label)
627                                       'Score)))
628          (ev (make-music 'MarkEvent
629                          'origin location)))
630
631     (if set
632         (make-sequential-music (list set ev))
633         (begin
634           (set! (ly:music-property ev 'label) label)
635           ev))))
636
637 musicMap =
638 #(define-music-function (parser location proc mus) (procedure? ly:music?)
639    (_i "Apply @var{proc} to @var{mus} and all of the music it contains.")
640    (music-map proc mus))
641
642 %% noPageBreak and noPageTurn are music functions (not music indentifiers),
643 %% because music identifiers are not allowed at top-level.
644 noPageBreak =
645 #(define-music-function (location parser) ()
646    (_i "Forbid a page break.  May be used at toplevel (i.e., between scores or
647 markups), or inside a score.")
648    (make-music 'EventChord
649                'page-marker #t
650                'page-break-permission 'forbid
651                'elements (list (make-music 'PageBreakEvent
652                                            'break-permission '()))))
653
654 noPageTurn =
655 #(define-music-function (location parser) ()
656    (_i "Forbid a page turn.  May be used at toplevel (i.e., between scores or
657 markups), or inside a score.")
658    (make-music 'EventChord
659                'page-marker #t
660                'page-turn-permission 'forbid
661                'elements (list (make-music 'PageTurnEvent
662                                            'break-permission '()))))
663
664
665
666 octaveCheck =
667 #(define-music-function (parser location pitch) (ly:pitch?)
668    (_i "Octave check.")
669    (make-music 'RelativeOctaveCheck
670                'pitch pitch))
671
672 once =
673 #(define-music-function (parser location music) (ly:music?)
674    (_i "Set @code{once} to @code{#t} on all layout instruction events in @var{music}.")
675    (music-map
676     (lambda (m)
677       (cond ((music-is-of-type? m 'layout-instruction-event)
678              (set! (ly:music-property m 'once) #t))
679             ((ly:duration? (ly:music-property m 'duration))
680              (ly:music-warning m (_ "Cannot apply \\once to timed music"))))
681       m)
682     music))
683
684 ottava =
685 #(define-music-function (parser location octave) (integer?)
686    (_i "Set the octavation.")
687    (make-music 'OttavaMusic
688                'ottava-number octave))
689
690 overrideTimeSignatureSettings =
691 #(define-music-function
692    (parser location time-signature base-moment beat-structure beam-exceptions)
693    (pair? pair? cheap-list? cheap-list?)
694
695    (_i "Override @code{timeSignatureSettings}
696 for time signatures of @var{time-signature} to have settings
697 of @var{base-moment}, @var{beat-structure}, and @var{beam-exceptions}.")
698
699    ;; TODO -- add warning if largest value of grouping is
700    ;;       greater than time-signature.
701   (let ((setting (make-setting base-moment beat-structure beam-exceptions)))
702     (override-time-signature-setting time-signature setting)))
703
704 overrideProperty =
705 #(define-music-function (parser location name property value)
706    (string? symbol? scheme?)
707
708    (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
709 The @var{name} argument is a string of the form @code{\"Context.GrobName\"}
710 or @code{\"GrobName\"}.")
711
712    (let ((name-components (string-split name #\.))
713          (context-name 'Bottom)
714          (grob-name #f))
715
716      (if (> 2 (length name-components))
717          (set! grob-name (string->symbol (car name-components)))
718          (begin
719            (set! grob-name (string->symbol (list-ref name-components 1)))
720            (set! context-name (string->symbol (list-ref name-components 0)))))
721
722      (make-music 'ApplyOutputEvent
723                  'context-type context-name
724                  'procedure
725                  (lambda (grob orig-context context)
726                    (if (equal?
727                         (cdr (assoc 'name (ly:grob-property grob 'meta)))
728                         grob-name)
729                        (set! (ly:grob-property grob property) value))))))
730
731
732
733 %% pageBreak and pageTurn are music functions (iso music indentifiers),
734 %% because music identifiers are not allowed at top-level.
735 pageBreak =
736 #(define-music-function (location parser) ()
737    (_i "Force a page break.  May be used at toplevel (i.e., between scores or
738 markups), or inside a score.")
739    (make-music 'EventChord
740                'page-marker #t
741                'line-break-permission 'force
742                'page-break-permission 'force
743                'elements (list (make-music 'LineBreakEvent
744                                            'break-permission 'force)
745                                (make-music 'PageBreakEvent
746                                            'break-permission 'force))))
747
748 pageTurn =
749 #(define-music-function (location parser) ()
750    (_i "Force a page turn between two scores or top-level markups.")
751    (make-music 'EventChord
752                'page-marker #t
753                'line-break-permission 'force
754                'page-break-permission 'force
755                'page-turn-permission 'force
756                'elements (list (make-music 'LineBreakEvent
757                                            'break-permission 'force)
758                                (make-music 'PageBreakEvent
759                                            'break-permission 'force)
760                                (make-music 'PageTurnEvent
761                                            'break-permission 'force))))
762
763 parallelMusic =
764 #(define-void-function (parser location voice-ids music) (list? ly:music?)
765    (_i "Define parallel music sequences, separated by '|' (bar check signs),
766 and assign them to the identifiers provided in @var{voice-ids}.
767
768 @var{voice-ids}: a list of music identifiers (symbols containing only letters)
769
770 @var{music}: a music sequence, containing BarChecks as limiting expressions.
771
772 Example:
773
774 @verbatim
775   \\parallelMusic #'(A B C) {
776     c c | d d | e e |
777     d d | e e | f f |
778   }
779 <==>
780   A = { c c | d d | }
781   B = { d d | e e | }
782   C = { e e | f f | }
783 @end verbatim
784 ")
785    (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
786           (current-voices voices)
787           (current-sequence (list))
788           (original music)
789           (wrapper #f))
790      ;;
791      ;; utilities
792      (define (push-music m)
793        "Push the music expression into the current sequence"
794        (set! current-sequence (cons m current-sequence)))
795      (define (change-voice)
796        "Stores the previously built sequence into the current voice and
797        change to the following voice."
798        (list-set! current-voices 0 (cons (make-music 'SequentialMusic
799                                                      'elements (reverse! current-sequence))
800                                          (car current-voices)))
801        (set! current-sequence (list))
802        (set! current-voices (cdr current-voices)))
803      (define (bar-check? m)
804        "Checks whether m is a bar check."
805        (eq? (ly:music-property m 'name) 'BarCheck))
806      (define (music-origin music)
807        "Recursively search an origin location stored in music."
808        (cond ((null? music) #f)
809              ((not (null? (ly:music-property music 'origin)))
810               (ly:music-property music 'origin))
811              (else (or (music-origin (ly:music-property music 'element))
812                        (let ((origins (remove not (map music-origin
813                                                        (ly:music-property music 'elements)))))
814                          (and (not (null? origins)) (car origins)))))))
815      (while (music-is-of-type? music 'music-wrapper-music)
816             (set! wrapper music)
817             (set! music (ly:music-property wrapper 'element)))
818      (if wrapper
819          (set! (ly:music-property wrapper 'element)
820                                   (make-music 'SequentialMusic
821                                               'origin location))
822          (set! original
823                (make-music 'SequentialMusic
824                            'origin location)))
825      ;;
826      ;; first, split the music and fill in voices
827      ;; We flatten direct layers of SequentialMusic since they are
828      ;; pretty much impossible to avoid when writing music functions.
829      (let rec ((music music))
830        (for-each (lambda (m)
831                    (if (eq? (ly:music-property m 'name) 'SequentialMusic)
832                        (rec m)
833                        (begin
834                          (push-music m)
835                          (if (bar-check? m) (change-voice)))))
836                  (ly:music-property music 'elements)))
837      (if (not (null? current-sequence)) (change-voice))
838      ;; un-circularize `voices' and reorder the voices
839      (set! voices (map-in-order (lambda (dummy seqs)
840                                   (reverse! seqs))
841                                 voice-ids voices))
842      ;;
843      ;; set origin location of each sequence in each voice
844      ;; for better type error tracking
845      (for-each (lambda (voice)
846                  (for-each (lambda (seq)
847                              (set! (ly:music-property seq 'origin)
848                                    (or (music-origin seq) location)))
849                            voice))
850                voices)
851      ;;
852      ;; check sequence length
853      (apply for-each (lambda* (#:rest seqs)
854                               (let ((moment-reference (ly:music-length (car seqs))))
855                                 (for-each (lambda (seq moment)
856                                             (if (not (equal? moment moment-reference))
857                                                 (ly:music-warning seq
858                                                                   "Bars in parallel music don't have the same length")))
859                                           seqs (map-in-order ly:music-length seqs))))
860             voices)
861      ;;
862      ;; bind voice identifiers to the voices
863      (for-each (lambda (voice-id voice)
864             (ly:parser-define! parser voice-id
865                                (let ((v (ly:music-deep-copy original)))
866                                  (set! (ly:music-property
867                                         (car (extract-named-music
868                                               v 'SequentialMusic))
869                                         'elements) voice)
870                                  v)))
871           voice-ids voices)))
872
873 parenthesize =
874 #(define-music-function (parser loc arg) (ly:music?)
875    (_i "Tag @var{arg} to be parenthesized.")
876
877    (if (memq 'event-chord (ly:music-property arg 'types))
878        ;; arg is an EventChord -> set the parenthesize property
879        ;; on all child notes and rests
880        (for-each
881         (lambda (ev)
882           (if (or (memq 'note-event (ly:music-property ev 'types))
883                   (memq 'rest-event (ly:music-property ev 'types)))
884               (set! (ly:music-property ev 'parenthesize) #t)))
885         (ly:music-property arg 'elements))
886        ;; No chord, simply set property for this expression:
887        (set! (ly:music-property arg 'parenthesize) #t))
888    arg)
889
890 partcombine =
891 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
892    (_i "Take the music in @var{part1} and @var{part2} and typeset so
893 that they share a staff.")
894    (make-part-combine-music parser
895                             (list part1 part2) #f))
896
897 partcombineUp =
898 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
899    (_i "Take the music in @var{part1} and @var{part2} and typeset so
900 that they share a staff with stems directed upward.")
901    (make-part-combine-music parser
902                             (list part1 part2) UP))
903
904 partcombineDown =
905 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
906    (_i "Take the music in @var{part1} and @var{part2} and typeset so
907 that they share a staff with stems directed downward.")
908    (make-part-combine-music parser
909                             (list part1 part2) DOWN))
910
911 partcombineForce =
912 #(define-music-function (location parser type once) (symbol-or-boolean? boolean?)
913    (_i "Override the part-combiner.")
914    (make-music 'EventChord
915                'elements (list (make-music 'PartCombineForceEvent
916                                            'forced-type type
917                                            'once once))))
918 partcombineApart = \partcombineForce #'apart ##f
919 partcombineApartOnce = \partcombineForce #'apart ##t
920 partcombineChords = \partcombineForce #'chords ##f
921 partcombineChordsOnce = \partcombineForce #'chords ##t
922 partcombineUnisono = \partcombineForce #'unisono ##f
923 partcombineUnisonoOnce = \partcombineForce #'unisono ##t
924 partcombineSoloI = \partcombineForce #'solo1 ##f
925 partcombineSoloIOnce = \partcombineForce #'solo1 ##t
926 partcombineSoloII = \partcombineForce #'solo2 ##f
927 partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
928 partcombineAutomatic = \partcombineForce ##f ##f
929 partcombineAutomaticOnce = \partcombineForce ##f ##t
930
931 partial =
932 #(define-music-function (parser location dur) (ly:duration?)
933   (_i "Make a partial measure.")
934
935   ;; We use `descend-to-context' here instead of `context-spec-music' to
936   ;; ensure \partial still works if the Timing_translator is moved
937     (descend-to-context
938      (context-spec-music (make-music 'PartialSet
939                                      'origin location
940                                      'partial-duration dur)
941                          'Timing)
942      'Score))
943
944 pitchedTrill =
945 #(define-music-function
946    (parser location main-note secondary-note)
947    (ly:music? ly:music?)
948    (_i "Print a trill with @var{main-note} as the main note of the trill and
949 print @var{secondary-note} as a stemless note head in parentheses.")
950    (let* ((get-notes (lambda (ev-chord)
951                        (extract-named-music ev-chord 'NoteEvent)))
952           (sec-note-events (get-notes secondary-note))
953           (trill-events (extract-named-music main-note 'TrillSpanEvent)))
954      (if (pair? sec-note-events)
955          (begin
956            (let* ((trill-pitch (ly:music-property (car sec-note-events) 'pitch))
957                   (forced (ly:music-property (car sec-note-events) 'force-accidental)))
958
959              (if (ly:pitch? trill-pitch)
960                  (for-each (lambda (m)
961                              (ly:music-set-property! m 'pitch trill-pitch)) trill-events)
962                  (begin
963                    (ly:input-warning location (_ "Second argument of \\pitchedTrill should be single note: "))
964                    (display sec-note-events)))
965
966              (if (eq? forced #t)
967                  (for-each (lambda (m)
968                              (ly:music-set-property! m 'force-accidental forced))
969                            trill-events)))))
970      main-note))
971
972 pushToTag =
973 #(define-music-function (parser location tag more music)
974    (symbol? ly:music? ly:music?)
975    (_i "Add @var{more} to the front of @code{elements} of all music
976 expressions in @var{music} that are tagged with @var{tag}.")
977    (music-map (lambda (m)
978                 (if (memq tag (ly:music-property m 'tags))
979                     (set! (ly:music-property m 'elements)
980                           (cons more (ly:music-property m 'elements))))
981                 m)
982               music))
983
984 quoteDuring =
985 #(define-music-function (parser location what main-music) (string? ly:music?)
986    (_i "Indicate a section of music to be quoted.  @var{what} indicates the name
987 of the quoted voice, as specified in an @code{\\addQuote} command.
988 @var{main-music} is used to indicate the length of music to be quoted;
989 usually contains spacers or multi-measure rests.")
990    (make-music 'QuoteMusic
991                'element main-music
992                'quoted-music-name what))
993
994 relative =
995 #(define-music-function (parser location pitch music)
996    ((ly:pitch? (ly:make-pitch 0 0 0)) ly:music?)
997    (_i "Make @var{music} relative to @var{pitch} (default @code{c'}).")
998    (ly:make-music-relative! music pitch)
999    (make-music 'RelativeOctaveMusic
1000                'element music))
1001
1002 removeWithTag =
1003 #(define-music-function (parser location tag music) (symbol? ly:music?)
1004    (_i "Remove elements of @var{music} that are tagged with @var{tag}.")
1005    (music-filter
1006     (lambda (m)
1007       (let* ((tags (ly:music-property m 'tags))
1008              (res (memq tag tags)))
1009         (not res)))
1010     music))
1011
1012 resetRelativeOctave =
1013 #(define-music-function (parser location pitch) (ly:pitch?)
1014    (_i "Set the octave inside a \\relative section.")
1015
1016    (make-music 'SequentialMusic
1017                'to-relative-callback
1018                (lambda (music last-pitch) pitch)))
1019
1020 retrograde =
1021 #(define-music-function (parser location music)
1022     (ly:music?)
1023     (_i "Return @var{music} in reverse order.")
1024     (retrograde-music music))
1025
1026 revertTimeSignatureSettings =
1027 #(define-music-function
1028    (parser location time-signature)
1029    (pair?)
1030
1031    (_i "Revert @code{timeSignatureSettings}
1032 for time signatures of @var{time-signature}.")
1033    (revert-time-signature-setting time-signature))
1034
1035 rightHandFinger =
1036 #(define-event-function (parser location finger) (number-or-string?)
1037    (_i "Apply @var{finger} as a fingering indication.")
1038
1039    (make-music
1040             'StrokeFingerEvent
1041             'origin location
1042             (if (string? finger) 'text 'digit)
1043             finger))
1044
1045 scaleDurations =
1046 #(define-music-function (parser location fraction music)
1047    (fraction? ly:music?)
1048    (_i "Multiply the duration of events in @var{music} by @var{fraction}.")
1049    (ly:music-compress music
1050                       (ly:make-moment (car fraction) (cdr fraction))))
1051
1052 settingsFrom =
1053 #(define-scheme-function (parser location ctx music)
1054    ((symbol?) ly:music?)
1055    (_i "Take the layout instruction events from @var{music}, optionally
1056 restricted to those applying to context type @var{ctx}, and return
1057 a context modification duplicating their effect.")
1058    (let ((mods (ly:make-context-mod)))
1059      (define (musicop m)
1060        (if (music-is-of-type? m 'layout-instruction-event)
1061            (ly:add-context-mod
1062             mods
1063             (case (ly:music-property m 'name)
1064               ((PropertySet)
1065                (list 'assign
1066                      (ly:music-property m 'symbol)
1067                      (ly:music-property m 'value)))
1068               ((PropertyUnset)
1069                (list 'unset
1070                      (ly:music-property m 'symbol)))
1071               ((OverrideProperty)
1072                (cons* 'push
1073                       (ly:music-property m 'symbol)
1074                       (ly:music-property m 'grob-value)
1075                       (ly:music-property m 'grob-property-path)))
1076               ((RevertProperty)
1077                (cons* 'pop
1078                       (ly:music-property m 'symbol)
1079                       (ly:music-property m 'grob-property-path)))))
1080            (case (ly:music-property m 'name)
1081              ((ApplyContext)
1082               (ly:add-context-mod mods
1083                                   (list 'apply
1084                                         (ly:music-property m 'procedure))))
1085              ((ContextSpeccedMusic)
1086               (if (or (not ctx)
1087                       (eq? ctx (ly:music-property m 'context-type)))
1088                   (musicop (ly:music-property m 'element))))
1089              (else
1090               (let ((callback (ly:music-property m 'elements-callback)))
1091                 (if (procedure? callback)
1092                     (for-each musicop (callback m))))))))
1093      (musicop music)
1094      mods))
1095
1096 shape =
1097 #(define-music-function (parser location grob offsets)
1098    (string? list?)
1099    (_i "Offset control-points of @var{grob} by @var{offsets}.  The argument
1100 is a list of number pairs or list of such lists.  Each element of a pair
1101 represents an offset to one of the coordinates of a control-point.")
1102    (define ((shape-curve offsets) grob)
1103      (let* ((orig (ly:grob-original grob))
1104             (siblings (if (ly:spanner? grob)
1105                           (ly:spanner-broken-into orig) '()))
1106             (total-found (length siblings))
1107             (function (assoc-get 'control-points
1108                                  (reverse (ly:grob-basic-properties grob))))
1109             (coords (function grob)))
1110
1111        (define (offset-control-points offsets)
1112          (if (null? offsets)
1113              coords
1114              (map
1115                (lambda (x y) (coord-translate x y))
1116                coords offsets)))
1117
1118        (define (helper sibs offs)
1119          (if (pair? offs)
1120              (if (eq? (car sibs) grob)
1121                  (offset-control-points (car offs))
1122                  (helper (cdr sibs) (cdr offs)))
1123              coords))
1124
1125        ;; we work with lists of lists
1126        (if (or (null? offsets)
1127                (not (list? (car offsets))))
1128            (set! offsets (list offsets)))
1129
1130        (if (>= total-found 2)
1131            (helper siblings offsets)
1132            (offset-control-points (car offsets)))))
1133
1134    #{
1135      \once \override $grob #'control-points = #(shape-curve offsets)
1136    #})
1137
1138 shiftDurations =
1139 #(define-music-function (parser location dur dots arg)
1140    (integer? integer? ly:music?)
1141    (_i "Change the duration of @var{arg} by adding @var{dur} to the
1142 @code{durlog} of @var{arg} and @var{dots} to the @code{dots} of @var{arg}.")
1143
1144    (music-map
1145     (lambda (x)
1146       (shift-one-duration-log x dur dots)) arg))
1147
1148 skip =
1149 #(define-music-function (parser location dur) (ly:duration?)
1150   (_i "Skip forward by @var{dur}.")
1151   (make-music 'SkipMusic
1152               'duration dur))
1153
1154
1155 slashedGrace =
1156 #(def-grace-function startSlashedGraceMusic stopSlashedGraceMusic
1157    (_i "Create slashed graces (slashes through stems, but no slur) from
1158 the following music expression"))
1159
1160 spacingTweaks =
1161 #(define-music-function (parser location parameters) (list?)
1162    (_i "Set the system stretch, by reading the 'system-stretch property of
1163 the `parameters' assoc list.")
1164    #{
1165      \overrideProperty #"Score.NonMusicalPaperColumn"
1166      #'line-break-system-details
1167      #(list (cons 'alignment-extra-space (cdr (assoc 'system-stretch parameters)))
1168              (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters))))
1169    #})
1170
1171 styledNoteHeads =
1172 #(define-music-function (parser location style heads music)
1173    (symbol? list-or-symbol? ly:music?)
1174    (_i "Set @var{heads} in @var{music} to @var{style}.")
1175    (style-note-heads heads style music))
1176
1177 tag =
1178 #(define-music-function (parser location tag arg) (symbol? ly:music?)
1179
1180    (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
1181
1182    (set!
1183     (ly:music-property arg 'tags)
1184     (cons tag
1185           (ly:music-property arg 'tags)))
1186    arg)
1187
1188 time =
1189 #(define-music-function (parser location beat-structure fraction)
1190    ((number-list? '()) fraction?)
1191    (_i "Set @var{fraction} as time signature, with optional
1192 number list @var{beat-structure} before it.")
1193   (make-music 'TimeSignatureMusic
1194               'numerator (car fraction)
1195               'denominator (cdr fraction)
1196               'beat-structure beat-structure))
1197
1198 times =
1199 #(define-music-function (parser location fraction music)
1200    (fraction? ly:music?)
1201    (_i "Scale @var{music} in time by @var{fraction}.")
1202   (make-music 'TimeScaledMusic
1203               'element (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction)))
1204               'numerator (car fraction)
1205               'denominator (cdr fraction)))
1206
1207 transpose =
1208 #(define-music-function
1209    (parser location from to music)
1210    (ly:pitch? ly:pitch? ly:music?)
1211
1212    (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}.")
1213    (make-music 'TransposedMusic
1214                'element (ly:music-transpose music (ly:pitch-diff to from))))
1215
1216 transposedCueDuring =
1217 #(define-music-function
1218    (parser location what dir pitch main-music)
1219    (string? ly:dir? ly:pitch? ly:music?)
1220
1221    (_i "Insert notes from the part @var{what} into a voice called @code{cue},
1222 using the transposition defined by @var{pitch}.  This happens
1223 simultaneously with @var{main-music}, which is usually a rest.  The
1224 argument @var{dir} determines whether the cue notes should be notated
1225 as a first or second voice.")
1226
1227    (make-music 'QuoteMusic
1228                'element main-music
1229                'quoted-context-type 'Voice
1230                'quoted-context-id "cue"
1231                'quoted-music-name what
1232                'quoted-voice-direction dir
1233                'quoted-transposition pitch))
1234
1235 transposition =
1236 #(define-music-function (parser location pitch) (ly:pitch?)
1237    (_i "Set instrument transposition")
1238
1239    (context-spec-music
1240     (make-property-set 'instrumentTransposition
1241                        (ly:pitch-negate pitch))
1242     'Staff))
1243
1244 tweak =
1245 #(define-music-function (parser location grob prop value music)
1246    ((string?) symbol? scheme? ly:music?)
1247    (_i "Add a tweak to the following @var{music}.
1248 Layout objects created by @var{music} get their property @var{prop}
1249 set to @var{value}.  If @var{grob} is specified, like with
1250 @example
1251 \\tweak Accidental #'color #red cis'
1252 @end example
1253 an indirectly created grob (@samp{Accidental} is caused by
1254 @samp{NoteHead}) can be tweaked; otherwise only directly created grobs
1255 are affected.")
1256    (if (not (object-property prop 'backend-type?))
1257        (begin
1258          (ly:input-warning location (_ "cannot find property type-check for ~a") prop)
1259          (ly:warning (_ "doing assignment anyway"))))
1260    (set!
1261     (ly:music-property music 'tweaks)
1262     (acons (if grob (cons (string->symbol grob) prop) prop)
1263            value
1264            (ly:music-property music 'tweaks)))
1265    music)
1266
1267 unfoldRepeats =
1268 #(define-music-function (parser location music) (ly:music?)
1269    (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or
1270 @code{\\repeat percent} commands in @var{music} to be interpreted
1271 as @code{\\repeat unfold}.")
1272    (unfold-repeats music))
1273
1274 void =
1275 #(define-void-function (parser location arg) (scheme?)
1276    (_i "Accept a scheme argument, return a void expression.
1277 Use this if you want to have a scheme expression evaluated
1278 because of its side-effects, but its value ignored."))
1279
1280 withMusicProperty =
1281 #(define-music-function (parser location sym val music)
1282    (symbol? scheme? ly:music?)
1283    (_i "Set @var{sym} to @var{val} in @var{music}.")
1284
1285    (set! (ly:music-property music sym) val)
1286    music)