1 @c -*- coding: utf-8; mode: texinfo; -*-
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. For details, see the Contributors'
8 Guide, node Updating translation committishes..
13 @node Interfaces for programmers
14 @chapter Interfaces for programmers
16 Advanced tweaks may be performed by using Scheme. If you are
17 not familiar with Scheme, you may wish to read our
18 @ref{Scheme tutorial}.
23 * Contexts for programmers::
24 * Callback functions::
25 * Inline Scheme code::
31 @section Music functions
33 @emph{Music functions} are scheme procedures that can create music
34 expressions automatically, and can be used to greatly simplify the
38 * Music function syntax::
39 * Simple substitution functions::
40 * Intermediate substitution functions::
41 * Mathematics in functions::
42 * Functions without arguments::
47 @node Music function syntax
48 @subsection Music function syntax
50 The general form for music functions is:
54 #(define-music-function
55 (parser location @var{arg1} @var{arg2} @dots{})
56 (@var{type1?} @var{type2?} @dots{})
63 @multitable @columnfractions .33 .66
64 @item @code{@var{argN}}
65 @tab @var{n}th argument
67 @item @code{@var{typeN?}}
68 @tab a scheme @emph{type predicate} for which @code{@var{argN}}
69 must return @code{#t}.
71 @item @code{@var{music}}
72 @tab A music expression, optionally written in scheme, with any
73 LilyPond code enclosed in hashed braces
74 (@tie{}@w{@code{#@{@dots{}#@}}}@tie{}). Within LilyPond code
75 blocks, use @code{$} to reference function arguments (eg.,
76 @samp{$arg1}) or to start an inline scheme expression containing
77 function arguments (eg., @w{@samp{$(cons arg1 arg2)}}).
82 For a list of available type predicates, see
83 @ruser{Predefined type predicates}. User-defined type predicates
90 @ruser{Predefined type predicates}.
93 @file{lily/music-scheme.cc},
98 @node Simple substitution functions
99 @subsection Simple substitution functions
101 Simple substitution functions are music functions whose output
102 music expression is written in LilyPond format and contains
103 function arguments in the output expression. They are described
104 in @ruser{Substitution function examples}.
107 @node Intermediate substitution functions
108 @subsection Intermediate substitution functions
110 Intermediate substitution functions involve a mix of Scheme code
111 and LilyPond code in the music expression to be returned.
113 Some @code{\override} commands require an argument consisting of
114 a pair of numbers (called a @emph{cons cell} in Scheme).
116 The pair can be directly passed into the music function,
117 using a @code{pair?} variable:
121 #(define-music-function
122 (parser location beg-end)
125 \once \override Beam #'positions = $beg-end
129 \manualBeam #'(3 . 6) c8 d e f
133 Alternatively, the numbers making up the pair can be
134 passed as separate arguments, and the Scheme code
135 used to create the pair can be included in the
138 @lilypond[quote,verbatim,ragged-right]
140 #(define-music-function
141 (parser location beg end)
144 \once \override Beam #'positions = $(cons beg end)
148 \manualBeam #3 #6 c8 d e f
153 @node Mathematics in functions
154 @subsection Mathematics in functions
156 Music functions can involve Scheme programming in
157 addition to simple substitution,
159 @lilypond[quote,verbatim,ragged-right]
161 #(define-music-function
162 (parser location mag)
165 \override Stem #'length = $(* 7.0 mag)
166 \override NoteHead #'font-size =
167 $(inexact->exact (* (/ 6.0 (log 2.0)) (log mag)))
171 \revert Stem #'length
172 \revert NoteHead #'font-size
177 \AltOn #1.5 c c \AltOff c2
182 This example may be rewritten to pass in music expressions,
184 @lilypond[quote,verbatim,ragged-right]
186 #(define-music-function
187 (parser location mag music)
190 \override Stem #'length = $(* 7.0 mag)
191 \override NoteHead #'font-size =
192 $(inexact->exact (* (/ 6.0 (log 2.0)) (log mag)))
194 \revert Stem #'length
195 \revert NoteHead #'font-size
199 c2 \withAlt #0.5 { c4 c }
200 \withAlt #1.5 { c c } c2
205 @node Functions without arguments
206 @subsection Functions without arguments
208 In most cases a function without arguments should be written
212 dolce = \markup@{ \italic \bold dolce @}
215 However, in rare cases it may be useful to create a music function
220 #(define-music-function
223 (if (eq? #t (ly:get-option 'display-bar-numbers))
224 #@{ \once \override Score.BarNumber #'break-visibility = ##f #@}
228 To actually display bar numbers where this function is called,
229 invoke @command{lilypond} with
232 lilypond -d display-bar-numbers FILENAME.ly
237 @subsection Void functions
239 A music function must return a music expression, but sometimes we
240 may want to have a function that does not involve music (such as
241 turning off Point and Click). To do this, we return a @code{void}
244 That is why the form that is returned is the
245 @w{@code{(make-music @dots{})}}. With the @code{'void} property
246 set to @code{#t}, the parser is told to actually disregard this
247 returned music expression. Thus the important part of the void
248 music function is the processing done by the function, not the
249 music expression that is returned.
253 #(define-music-function
256 (ly:set-option 'point-and-click #f)
257 (make-music 'SequentialMusic 'void #t))
259 \noPointAndClick % disable point and click
263 @node Markup functions
264 @section Markup functions
266 Markups are implemented as special Scheme functions which produce a
267 @code{Stencil} object given a number of arguments.
270 * Markup construction in Scheme::
271 * How markups work internally::
272 * New markup command definition::
273 * New markup list command definition::
277 @node Markup construction in Scheme
278 @subsection Markup construction in Scheme
280 @cindex defining markup commands
282 The @code{markup} macro builds markup expressions in Scheme while
283 providing a LilyPond-like syntax. For example,
285 (markup #:column (#:line (#:bold #:italic "hello" #:raise 0.4 "world")
286 #:larger #:line ("foo" "bar" "baz")))
292 \markup \column @{ \line @{ \bold \italic "hello" \raise #0.4 "world" @}
293 \larger \line @{ foo bar baz @} @}
297 This example demonstrates the main translation rules between regular
298 LilyPond markup syntax and Scheme markup syntax.
301 @multitable @columnfractions .3 .3
302 @item @b{LilyPond} @tab @b{Scheme}
303 @item @code{\markup markup1} @tab @code{(markup markup1)}
304 @item @code{\markup @{ markup1 markup2 ... @}} @tab
305 @code{(markup markup1 markup2 ... )}
306 @item @code{\markup-command} @tab @code{#:markup-command}
307 @item @code{\variable} @tab @code{variable}
308 @item @code{\center-column @{ ... @}} @tab @code{#:center-column ( ... )}
309 @item @code{string} @tab @code{"string"}
310 @item @code{#scheme-arg} @tab @code{scheme-arg}
314 The whole Scheme language is accessible inside the
315 @code{markup} macro. For example, You may use function calls inside
316 @code{markup} in order to manipulate character strings. This is
317 useful when defining new markup commands (see
318 @ref{New markup command definition}).
323 The markup-list argument of commands such as @code{#:line},
324 @code{#:center}, and @code{#:column} cannot be a variable or
325 the result of a function call.
328 (markup #:line (function-that-returns-markups))
332 is invalid. One should use the @code{make-line-markup},
333 @code{make-center-markup}, or @code{make-column-markup} functions
337 (markup (make-line-markup (function-that-returns-markups)))
341 @node How markups work internally
342 @subsection How markups work internally
347 \raise #0.5 "text example"
351 @code{\raise} is actually represented by the @code{raise-markup}
352 function. The markup expression is stored as
355 (list raise-markup 0.5 (list simple-markup "text example"))
358 When the markup is converted to printable objects (Stencils), the
359 @code{raise-markup} function is called as
364 @var{list of property alists}
366 @var{the "text example" markup})
369 The @code{raise-markup} function first creates the stencil for the
370 @code{text example} string, and then it raises that Stencil by 0.5
371 staff space. This is a rather simple example; more complex examples
373 of this section, and in @file{scm/define-markup-commands.scm}.
376 @node New markup command definition
377 @subsection New markup command definition
379 This section discusses the definition of new markup commands.
382 * Markup command definition syntax::
384 * A complete example::
385 * Adapting builtin commands::
388 @node Markup command definition syntax
389 @unnumberedsubsubsec Markup command definition syntax
391 New markup commands can be defined using the
392 @code{define-markup-command} Scheme macro, at top-level.
395 (define-markup-command (@var{command-name} @var{layout} @var{props} @var{arg1} @var{arg2} ...)
396 (@var{arg1-type?} @var{arg2-type?} ...)
397 [ #:properties ((@var{property1} @var{default-value1})
405 @item @var{command-name}
406 the markup command name
408 the @q{layout} definition.
410 a list of associative lists, containing all active properties.
412 @var{i}th command argument
413 @item @var{argi-type?}
414 a type predicate for the i@var{th} argument
417 If the command uses properties from the @code{props} arguments,
418 the @code{#:properties} keyword can be used to specify which
419 properties are used along with their default values.
421 Arguments are distinguished according to their type:
423 @item a markup, corresponding to type predicate @code{markup?};
424 @item a list of markups, corresponding to type predicate
426 @item any other scheme object, corresponding to type predicates such as
427 @code{list?}, @code{number?}, @code{boolean?}, etc.
430 There is no limitation on the order of arguments (after the
431 standard @code{layout} and @code{props} arguments). However,
432 markup functions taking a markup as their last argument are
433 somewhat special as you can apply them to a markup list, and the
434 result is a markup list where the markup function (with the
435 specified leading arguments) has been applied to every element of
436 the original markup list.
438 Since replicating the leading arguments for applying a markup
439 function to a markup list is cheap mostly for Scheme arguments,
440 you avoid performance pitfalls by just using Scheme arguments for
441 the leading arguments of markup functions that take a markup as
445 @unnumberedsubsubsec On properties
447 The @code{layout} and @code{props} arguments of markup commands bring a
448 context for the markup interpretation: font size, line width, etc.
450 The @code{layout} argument allows access to properties defined in
451 @code{paper} blocks, using the @code{ly:output-def-lookup} function.
452 For instance, the line width (the same as the one used in scores) is
456 (ly:output-def-lookup layout 'line-width)
459 The @code{props} argument makes some properties accessible to markup
460 commands. For instance, when a book title markup is interpreted, all
461 the variables defined in the @code{\header} block are automatically
462 added to @code{props}, so that the book title markup can access the book
463 title, composer, etc. It is also a way to configure the behaviour of a
464 markup command: for example, when a command uses font size during
465 processing, the font size is read from @code{props} rather than having a
466 @code{font-size} argument. The caller of a markup command may change
467 the value of the font size property in order to change the behaviour.
468 Use the @code{#:properties} keyword of @code{define-markup-command} to
469 specify which properties shall be read from the @code{props} arguments.
471 The example in next section illustrates how to access and override
472 properties in a markup command.
474 @node A complete example
475 @unnumberedsubsubsec A complete example
477 The following example defines a markup command to draw a double box
478 around a piece of text.
480 Firstly, we need to build an approximative result using markups.
481 Consulting the @ruser{Text markup commands} shows us the @code{\box}
484 @lilypond[quote,verbatim,ragged-right]
485 \markup \box \box HELLO
488 Now, we consider that more padding between the text and the boxes is
489 preferable. According to the @code{\box} documentation, this command
490 uses a @code{box-padding} property, which defaults to 0.2. The
491 documentation also mentions how to override it:
493 @lilypond[quote,verbatim,ragged-right]
494 \markup \box \override #'(box-padding . 0.6) \box A
497 Then, the padding between the two boxes is considered too small, so we
500 @lilypond[quote,verbatim,ragged-right]
501 \markup \override #'(box-padding . 0.4) \box \override #'(box-padding . 0.6) \box A
504 Repeating this lengthy markup would be painful. This is where a markup
505 command is needed. Thus, we write a @code{double-box} markup command,
506 taking one argument (the text). This draws the two boxes, with some
510 #(define-markup-command (double-box layout props text) (markup?)
511 "Draw a double box around text."
512 (interpret-markup layout props
513 (markup #:override '(box-padding . 0.4) #:box
514 #:override '(box-padding . 0.6) #:box text)))
517 @code{text} is the name of the command argument, and @code{markup?} its
518 type: it identifies it as a markup. The @code{interpret-markup}
519 function is used in most of markup commands: it builds a stencil, using
520 @code{layout}, @code{props}, and a markup. Here, this markup is built
521 using the @code{markup} scheme macro, see @ref{Markup construction in Scheme}.
522 The transformation from @code{\markup} expression to scheme
523 markup expression is straight-forward.
525 The new command can be used as follow:
528 \markup \double-box A
531 It would be nice to make the @code{double-box} command customizable:
532 here, the @code{box-padding} values are hard coded, and cannot be
533 changed by the user. Also, it would be better to distinguish the
534 padding between the two boxes, from the padding between the inner box
535 and the text. So we will introduce a new property,
536 @code{inter-box-padding}, for the padding between the two boxes. The
537 @code{box-padding} will be used for the inner padding. The new code is
541 #(define-markup-command (double-box layout props text) (markup?)
542 #:properties ((inter-box-padding 0.4)
544 "Draw a double box around text."
545 (interpret-markup layout props
546 (markup #:override `(box-padding . ,inter-box-padding) #:box
547 #:override `(box-padding . ,box-padding) #:box text)))
550 Here, the @code{#:properties} keyword is used so that the
551 @code{inter-box-padding} and @code{box-padding} properties are read from
552 the @code{props} argument, and default values are given to them if the
553 properties are not defined.
555 Then, these values are used to override the @code{box-padding}
556 properties used by the two @code{\box} commands. Note the backquote and
557 the comma in the @code{\override} argument: they allow you to introduce
558 a variable value into a literal expression.
560 Now, the command can be used in a markup, and the boxes padding be
563 @lilypond[quote,verbatim,ragged-right]
564 #(define-markup-command (double-box layout props text) (markup?)
565 #:properties ((inter-box-padding 0.4)
567 "Draw a double box around text."
568 (interpret-markup layout props
569 (markup #:override `(box-padding . ,inter-box-padding) #:box
570 #:override `(box-padding . ,box-padding) #:box text)))
572 \markup \double-box A
573 \markup \override #'(inter-box-padding . 0.8) \double-box A
574 \markup \override #'(box-padding . 1.0) \double-box A
577 @node Adapting builtin commands
578 @unnumberedsubsubsec Adapting builtin commands
580 A good way to start writing a new markup command, is to take example on
581 a builtin one. Most of the markup commands provided with LilyPond can be
582 found in file @file{scm/define-markup-commands.scm}.
584 For instance, we would like to adapt the @code{\draw-line} command, to
585 draw a double line instead. The @code{\draw-line} command is defined as
586 follow (documentation stripped):
589 (define-markup-command (draw-line layout props dest)
592 #:properties ((thickness 1))
594 (let ((th (* (ly:output-def-lookup layout 'line-thickness)
598 (make-line-stencil th 0 0 x y)))
601 To define a new command based on an existing one, copy the definition,
602 and change the command name. The @code{#:category} keyword can be
603 safely removed, as it is only used for generating LilyPond
604 documentation, and is of no use for user-defined markup commands.
607 (define-markup-command (draw-double-line layout props dest)
609 #:properties ((thickness 1))
611 (let ((th (* (ly:output-def-lookup layout 'line-thickness)
615 (make-line-stencil th 0 0 x y)))
618 Then, a property for setting the gap between two lines is added, called
619 @code{line-gap}, defaulting e.g. to 0.6:
622 (define-markup-command (draw-double-line layout props dest)
624 #:properties ((thickness 1)
630 Finally, the code for drawing two lines is added. Two calls to
631 @code{make-line-stencil} are used to draw the lines, and the resulting
632 stencils are combined using @code{ly:stencil-add}:
634 @lilypond[quote,verbatim,ragged-right]
635 #(define-markup-command (my-draw-line layout props dest)
637 #:properties ((thickness 1)
640 (let* ((th (* (ly:output-def-lookup layout 'line-thickness)
645 (x (cond ((= dx 0) w)
647 (else (/ w (sqrt (+ 1 (* (/ dx dy) (/ dx dy))))))))
648 (y (* (if (< (* dx dy) 0) 1 -1)
651 (else (/ w (sqrt (+ 1 (* (/ dy dx) (/ dy dx))))))))))
652 (ly:stencil-add (make-line-stencil th x y (+ dx x) (+ dy y))
653 (make-line-stencil th (- x) (- y) (- dx x) (- dy y)))))
655 \markup \my-draw-line #'(4 . 3)
656 \markup \override #'(line-gap . 1.2) \my-draw-line #'(4 . 3)
660 @node New markup list command definition
661 @subsection New markup list command definition
662 Markup list commands are defined with the
663 @code{define-markup-list-command} Scheme macro, which is similar to the
664 @code{define-markup-command} macro described in
665 @ref{New markup command definition}, except that where the latter returns
666 a single stencil, the former returns a list of stencils.
668 In the following example, a @code{\paragraph} markup list command is
669 defined, which returns a list of justified lines, the first one being
670 indented. The indent width is taken from the @code{props} argument.
672 #(define-markup-list-command (paragraph layout props args) (markup-list?)
673 #:properties ((par-indent 2))
674 (interpret-markup-list layout props
675 (make-justified-lines-markup-list (cons (make-hspace-markup par-indent)
679 Besides the usual @code{layout} and @code{props} arguments, the
680 @code{paragraph} markup list command takes a markup list argument, named
681 @code{args}. The predicate for markup lists is @code{markup-list?}.
683 First, the function gets the indent width, a property here named
684 @code{par-indent}, from the property list @code{props}. If the
685 property is not found, the default value is @code{2}. Then, a
686 list of justified lines is made using the
687 @code{make-justified-lines-markup-list} function, which is related
688 to the @code{\justified-lines} built-in markup list command. A
689 horizontal space is added at the beginning using the
690 @code{make-hspace-markup} function. Finally, the markup list is
691 interpreted using the @code{interpret-markup-list} function.
693 This new markup list command can be used as follows:
697 The art of music typography is called \italic @{(plate) engraving.@}
698 The term derives from the traditional process of music printing.
699 Just a few decades ago, sheet music was made by cutting and stamping
700 the music into a zinc or pewter plate in mirror image.
702 \override-lines #'(par-indent . 4) \paragraph @{
703 The plate would be inked, the depressions caused by the cutting
704 and stamping would hold ink. An image was formed by pressing paper
705 to the plate. The stamping and cutting was completely done by
711 @node Contexts for programmers
712 @section Contexts for programmers
715 * Context evaluation::
716 * Running a function on all layout objects::
719 @node Context evaluation
720 @subsection Context evaluation
722 @cindex calling code during interpreting
723 @funindex \applyContext
725 Contexts can be modified during interpretation with Scheme code. The
728 \applyContext @var{function}
731 @code{@var{function}} should be a Scheme function that takes a
732 single argument: the context in which the @code{\applyContext}
733 command is being called. The following code will print the
734 current bar number on the standard output during the compile:
739 (format #t "\nWe were called in barnumber ~a.\n"
740 (ly:context-property x 'currentBarNumber)))
745 @node Running a function on all layout objects
746 @subsection Running a function on all layout objects
749 @cindex calling code on layout objects
750 @funindex \applyOutput
753 The most versatile way of tuning an object is @code{\applyOutput} which
754 works by inserting an event into the specified context
755 (@rinternals{ApplyOutputEvent}). Its syntax is
757 \applyOutput @var{context} @var{proc}
761 where @code{@var{proc}} is a Scheme function, taking three arguments.
763 When interpreted, the function @code{@var{proc}} is called for
764 every layout object found in the context @code{@var{context}} at
765 the current time step, with the following arguments:
767 @item the layout object itself,
768 @item the context where the layout object was created, and
769 @item the context where @code{\applyOutput} is processed.
773 In addition, the cause of the layout object, i.e., the music
774 expression or object that was responsible for creating it, is in the
775 object property @code{cause}. For example, for a note head, this is a
776 @rinternals{NoteHead} event, and for a stem object,
777 this is a @rinternals{Stem} object.
779 Here is a function to use for @code{\applyOutput}; it blanks
780 note-heads on the center-line and next to it:
782 @lilypond[quote,verbatim,ragged-right]
783 #(define (blanker grob grob-origin context)
784 (if (and (memq 'note-head-interface (ly:grob-interfaces grob))
785 (< (abs (ly:grob-property grob 'staff-position)) 2))
786 (set! (ly:grob-property grob 'transparent) #t)))
789 a'4 e8 <<\applyOutput #'Voice #blanker a c d>> b2
794 @node Callback functions
795 @section Callback functions
797 Properties (like @code{thickness}, @code{direction}, etc.) can be
798 set at fixed values with @code{\override}, e.g.
801 \override Stem #'thickness = #2.0
804 Properties can also be set to a Scheme procedure,
806 @lilypond[fragment,verbatim,quote,relative=2]
807 \override Stem #'thickness = #(lambda (grob)
808 (if (= UP (ly:grob-property grob 'direction))
815 In this case, the procedure is executed as soon as the value of the
816 property is requested during the formatting process.
818 Most of the typesetting engine is driven by such callbacks.
819 Properties that typically use callbacks include
823 The printing routine, that constructs a drawing for the symbol
825 The routine that sets the horizontal position
827 The routine that computes the width of an object
830 The procedure always takes a single argument, being the grob.
832 If routines with multiple arguments must be called, the current grob
833 can be inserted with a grob closure. Here is a setting from
834 @code{AccidentalSuggestion},
838 ,(ly:make-simple-closure
840 ,(ly:make-simple-closure
841 (list ly:self-alignment-interface::centered-on-x-parent))
842 ,(ly:make-simple-closure
843 (list ly:self-alignment-interface::x-aligned-on-self)))))
847 In this example, both @code{ly:self-alignment-interface::x-aligned-on-self} and
848 @code{ly:self-alignment-interface::centered-on-x-parent} are called
849 with the grob as argument. The results are added with the @code{+}
850 function. To ensure that this addition is properly executed, the whole
851 thing is enclosed in @code{ly:make-simple-closure}.
853 In fact, using a single procedure as property value is equivalent to
856 (ly:make-simple-closure (ly:make-simple-closure (list @var{proc})))
860 The inner @code{ly:make-simple-closure} supplies the grob as argument
861 to @var{proc}, the outer ensures that result of the function is
862 returned, rather than the @code{simple-closure} object.
864 From within a callback, the easiest method for evaluating a markup is
865 to use grob-interpret-markup. For example:
868 my-callback = #(lambda (grob)
869 (grob-interpret-markup grob (markup "foo")))
872 @node Inline Scheme code
873 @section Inline Scheme code
875 The main disadvantage of @code{\tweak} is its syntactical
876 inflexibility. For example, the following produces a syntax error.
879 F = \tweak #'font-size #-3 -\flageolet
887 In other words, @code{\tweak} doesn't behave like an articulation
888 regarding the syntax; in particular, it can't be attached with
889 @code{^} and @code{_}.
891 Using Scheme, this problem can be avoided. The route to the
892 result is given in @ref{Adding articulation to notes (example)},
893 especially how to use @code{\displayMusic} as a helping guide.
896 F = #(let ((m (make-music 'ArticulationEvent
897 'articulation-type "flageolet")))
898 (set! (ly:music-property m 'tweaks)
900 (ly:music-property m 'tweaks)))
909 Here, the @code{tweaks} properties of the flageolet object
910 @code{m} (created with @code{make-music}) are extracted with
911 @code{ly:music-property}, a new key-value pair to change the
912 font size is prepended to the property list with the
913 @code{acons} Scheme function, and the result is finally
914 written back with @code{set!}. The last element of the
915 @code{let} block is the return value, @code{m} itself.
919 @node Difficult tweaks
920 @section Difficult tweaks
922 There are a few classes of difficult adjustments.
928 One type of difficult adjustment involves the appearance of
929 spanner objects, such as slurs and ties. Usually, only one
930 spanner object is created at a time, and it can be adjusted with
931 the normal mechanism. However, occasionally a spanner crosses a
932 line break. When this happens, the object is cloned. A separate
933 object is created for every system in which the spanner appears.
934 The new objects are clones of the original object and inherit all
935 properties, including @code{\override}s.
938 In other words, an @code{\override} always affects all pieces of a
939 broken spanner. To change only one part of a spanner at a line break,
940 it is necessary to hook into the formatting process. The
941 @code{after-line-breaking} callback contains the Scheme procedure that
942 is called after the line breaks have been determined and layout
943 objects have been split over different systems.
945 In the following example, we define a procedure
946 @code{my-callback}. This procedure
950 determines if the spanner has been split across line breaks
952 if yes, retrieves all the split objects
954 checks if this grob is the last of the split objects
956 if yes, it sets @code{extra-offset}.
959 This procedure is installed into @rinternals{Tie}, so the last part
960 of the broken tie is repositioned.
962 @lilypond[quote,verbatim,ragged-right]
963 #(define (my-callback grob)
965 ;; have we been split?
966 (orig (ly:grob-original grob))
968 ;; if yes, get the split pieces (our siblings)
969 (siblings (if (ly:grob? orig)
970 (ly:spanner-broken-into orig)
973 (if (and (>= (length siblings) 2)
974 (eq? (car (last-pair siblings)) grob))
975 (ly:grob-set-property! grob 'extra-offset '(-2 . 5)))))
978 \override Tie #'after-line-breaking =
986 When applying this trick, the new @code{after-line-breaking} callback
987 should also call the old one, if such a default exists. For example,
988 if using this with @code{Hairpin}, @code{ly:spanner::kill-zero-spanned-time}
989 should also be called.
993 Some objects cannot be changed with @code{\override} for
994 technical reasons. Examples of those are @code{NonMusicalPaperColumn}
995 and @code{PaperColumn}. They can be changed with the
996 @code{\overrideProperty} function, which works similar to @code{\once
997 \override}, but uses a different syntax.
1001 #"Score.NonMusicalPaperColumn" % Grob name
1002 #'line-break-system-details % Property name
1003 #'((next-padding . 20)) % Value
1006 Note, however, that @code{\override}, applied to
1007 @code{NonMusicalPaperColumn} and @code{PaperColumn}, still works as
1008 expected within @code{\context} blocks.
1012 @node LilyPond Scheme interfaces
1013 @chapter LilyPond Scheme interfaces
1015 This chapter covers the various tools provided by LilyPond to help
1016 Scheme programmers get information into and out of the music streams.
1018 TODO -- figure out what goes in here and how to organize it