X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fuser%2Fprogramming-interface.itely;h=8c45e57d26c38827d5e2e9d487252b0eabb3558f;hb=d5e87e70e8d581ac6865565f4c2237a74212171d;hp=47496aa9d6b36a9a9da8f5173e2d62950d484e89;hpb=d02446a61d3eabfde67ed48928ae07766c97750f;p=lilypond.git diff --git a/Documentation/user/programming-interface.itely b/Documentation/user/programming-interface.itely index 47496aa9d6..8c45e57d26 100644 --- a/Documentation/user/programming-interface.itely +++ b/Documentation/user/programming-interface.itely @@ -87,11 +87,25 @@ written as @{ #(ly:export (make-sequential-music (list newLa))) @} @end example +Scheme code is evaluated as soon as the parser encounters it. To +define some scheme code in a macro (to be called later), use + +@example +#(define (nopc) + (ly:set-option 'point-and-click #f)) + +... +#(nopc) +@{ c'4 @} +@end example + + @refbugs Mixing Scheme and LilyPond identifiers is not possible with the @code{--safe} option. + @node Internal music representation @subsection Internal music representation @@ -201,12 +215,12 @@ applyMusic = #(ly:make-music-function (func music))) @end example -A @code{def-music-function} macro is introduced on top of +A @code{define-music-function} macro is introduced on top of @code{ly:make-music-function} to ease the definition of music functions: @example -applyMusic = #(def-music-function (parser location func music) +applyMusic = #(define-music-function (parser location func music) (procedure? ly:music?) (func music)) @end example @@ -426,7 +440,7 @@ This function may also be defined as a music function: @lilypond[quote,verbatim,ragged-right] withPadding = - #(def-music-function (parser location padding music) (number? ly:music?) + #(define-music-function (parser location padding music) (number? ly:music?) #{ \override TextScript #'padding = #$padding $music \revert TextScript #'padding #}) @@ -554,9 +568,9 @@ of this section, and in @file{scm/@/define@/-markup@/-commands@/.scm}. @subsection Markup command definition New markup commands can be defined -with the @code{def-markup-command} scheme macro. +with the @code{define-markup-command} scheme macro. @lisp -(def-markup-command (@var{command-name} @var{layout} @var{props} @var{arg1} @var{arg2} ...) +(define-markup-command (@var{command-name} @var{layout} @var{props} @var{arg1} @var{arg2} ...) (@var{arg1-type?} @var{arg2-type?} ...) ..command body..) @end lisp @@ -586,11 +600,11 @@ This selects the caps font by setting the @code{font-shape} property to @code{#'caps} for interpreting @code{Text-in-caps}. To make the above available as @code{\smallcaps} command, we have to -define a function using @code{def-markup-command}. The command should +define a function using @code{define-markup-command}. The command should take a single argument, of type markup. Therefore, the start of the definition should read @example -(def-markup-command (smallcaps layout props argument) (markup?) +(define-markup-command (smallcaps layout props argument) (markup?) @end example @noindent @@ -624,7 +638,7 @@ that takes into account the necessary translation, and uses the newly defined @code{\smallcaps} command: @example -#(def-markup-command (character layout props name) (string?) +#(define-markup-command (character layout props name) (string?) "Print the character name in small caps, translated to the left and top. Syntax: \\character #\"name\"" (interpret-markup layout props @@ -649,7 +663,7 @@ The final result is as follows: @end example @lilypond[quote,ragged-right] -#(def-markup-command (smallcaps layout props str) (string?) +#(define-markup-command (smallcaps layout props str) (string?) "Print the string argument in small caps. Syntax: \\smallcaps #\"string\"" (interpret-markup layout props (make-line-markup @@ -661,7 +675,7 @@ The final result is as follows: #:tiny (string-upcase (substring s 1))))) (string-split str #\Space))))) -#(def-markup-command (character layout props name) (string?) +#(define-markup-command (character layout props name) (string?) "Print the character name in small caps, translated to the left and top. Syntax: \\character #\"name\"" (interpret-markup layout props @@ -679,7 +693,7 @@ the small caps font by setting a string in upcase with the first letter a little larger: @example -#(def-markup-command (smallcaps layout props str) (string?) +#(define-markup-command (smallcaps layout props str) (string?) "Print the string argument in small caps." (interpret-markup layout props (make-line-markup