From: Keith OHara Date: Sun, 27 Jul 2014 20:15:18 +0000 (-0700) Subject: Undocument the Scheme interface to make-simple closure X-Git-Tag: release/2.19.11-1~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c5c63c1e1db0ce931dbd71066eeda38d94541076;p=lilypond.git Undocument the Scheme interface to make-simple closure in favor of lambdas; issue 3993 --- diff --git a/Documentation/extending/programming-interface.itely b/Documentation/extending/programming-interface.itely index 9c4cbe7805..be58003442 100644 --- a/Documentation/extending/programming-interface.itely +++ b/Documentation/extending/programming-interface.itely @@ -1375,38 +1375,6 @@ can by found in the Internals Reference or the file 'define-grobs.scm': @} @end example -If routines with multiple arguments must be called, the current grob -can be inserted with a grob closure. Here is a setting from -@code{RehearsalMark}, - -@example -`(X-offset . - ,(ly:make-simple-closure - `(,+ - ,(ly:make-simple-closure - (list ly:break-alignable-interface::self-align-callback)) - ,(ly:make-simple-closure - (list ly:self-alignment-interface::x-aligned-on-self))))) -@end example - -@noindent -In this example, both @code{ly:break-alignable-interface::self-align-callback} and -@code{ly:self-alignment-interface::x-aligned-on-self} are called -with the grob as argument. The results are added with the @code{+} -function. To ensure that this addition is properly executed, the whole -thing is enclosed in @code{ly:make-simple-closure}. - -In fact, using a single procedure as property value is equivalent to - -@example -(ly:make-simple-closure (ly:make-simple-closure (list @var{proc}))) -@end example - -@noindent -The inner @code{ly:make-simple-closure} supplies the grob as argument -to @var{proc}, the outer ensures that result of the function is -returned, rather than the @code{simple-closure} object. - From within a callback, the easiest method for evaluating a markup is to use grob-interpret-markup. For example: diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index ea606ece06..05a843de58 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -262,12 +262,7 @@ (self-alignment-X . ,RIGHT) (side-axis . ,Y) (stencil . ,ly:text-interface::print) - (X-offset . ,(ly:make-simple-closure - `(,+ - ,(ly:make-simple-closure - (list ly:break-alignable-interface::self-align-callback)) - ,(ly:make-simple-closure - (list ly:self-alignment-interface::x-aligned-on-self))))) + (X-offset . ,self-alignment-interface::self-aligned-on-breakable) (Y-offset . ,side-position-interface::y-aligned-side) (Y-extent . ,grob::always-Y-extent-from-stencil) (meta . @@ -1473,12 +1468,7 @@ (stencil . ,ly:text-interface::print) (vertical-skylines . ,grob::always-vertical-skylines-from-stencil) (Y-offset . ,side-position-interface::y-aligned-side) - (X-offset . ,(ly:make-simple-closure - `(,+ - ,(ly:make-simple-closure - (list ly:break-alignable-interface::self-align-callback)) - ,(ly:make-simple-closure - (list ly:self-alignment-interface::x-aligned-on-self))))) + (X-offset . ,self-alignment-interface::self-aligned-on-breakable) (self-alignment-X . ,LEFT) (break-align-symbols . (time-signature)) (non-break-align-symbols . (paper-column-interface)) @@ -1812,12 +1802,7 @@ (self-alignment-X . ,CENTER) (stencil . ,ly:text-interface::print) (vertical-skylines . ,grob::always-vertical-skylines-from-stencil) - (X-offset . ,(ly:make-simple-closure - `(,+ - ,(ly:make-simple-closure - (list ly:break-alignable-interface::self-align-callback)) - ,(ly:make-simple-closure - (list ly:self-alignment-interface::x-aligned-on-self))))) + (X-offset . ,self-alignment-interface::self-aligned-on-breakable) (Y-offset . ,side-position-interface::y-aligned-side) (Y-extent . ,grob::always-Y-extent-from-stencil) (meta . ((class . Item) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index c607fe4122..2df06bd528 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -249,6 +249,14 @@ ly:self-alignment-interface::y-aligned-on-self ly:self-alignment-interface::pure-y-aligned-on-self)) +(define-public (self-alignment-interface::self-aligned-on-breakable grob) + "Return the @code{X-offset} that places @var{grob} according to its + @code{self-alignment-X} over the reference point defined by the + @code{break-align-anchor-alignment} of a @code{break-aligned} item + such as a @code{Clef}." + (+ (ly:break-alignable-interface::self-align-callback grob) + (ly:self-alignment-interface::x-aligned-on-self grob))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; staff symbol