From: David Kastrup Date: Wed, 19 Oct 2011 12:50:57 +0000 (+0200) Subject: Define define-void-function and \void X-Git-Tag: release/2.15.15-1~21 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=458fd4607f01a2ef304db3ba65921f488f4016e5;p=lilypond.git Define define-void-function and \void --- diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index af09d9db14..369d62ea3f 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -38,13 +38,13 @@ acciaccatura = %% keep these two together "instrument-definitions" = #'() addInstrumentDefinition = -#(define-scheme-function +#(define-void-function (parser location name lst) (string? list?) (_i "Create instrument @var{name} with properties @var{list}.") (set! instrument-definitions (acons name lst instrument-definitions))) addQuote = -#(define-scheme-function (parser location name music) (string? ly:music?) +#(define-void-function (parser location name music) (string? ly:music?) (_i "Define @var{music} as a quotable music expression named @var{name}") (add-quotable parser name music)) @@ -194,12 +194,12 @@ bendAfter = 'delta-step delta)) bookOutputName = -#(define-scheme-function (parser location newfilename) (string?) +#(define-void-function (parser location newfilename) (string?) (_i "Direct output for the current book block to @var{newfilename}.") (set! book-filename newfilename)) bookOutputSuffix = -#(define-scheme-function (parser location newsuffix) (string?) +#(define-void-function (parser location newsuffix) (string?) (_i "Set the output filename suffix for the current book block to @var{newsuffix}.") (set! book-output-suffix newsuffix)) @@ -501,18 +501,18 @@ label = language = -#(define-scheme-function (parser location language) (string?) +#(define-void-function (parser location language) (string?) (_i "Set note names for language @var{language}.") (note-names-language parser language)) languageSaveAndChange = -#(define-scheme-function (parser location language) (string?) +#(define-void-function (parser location language) (string?) (_i "Store the previous pitchnames alist, and set a new one.") (set! previous-pitchnames pitchnames) (note-names-language parser language)) languageRestore = -#(define-scheme-function (parser location) () +#(define-void-function (parser location) () (_i "Restore a previously-saved pitchnames alist.") (if previous-pitchnames (begin @@ -666,7 +666,7 @@ pageTurn = 'break-permission 'force)))) parallelMusic = -#(define-scheme-function (parser location voice-ids music) (list? ly:music?) +#(define-void-function (parser location voice-ids music) (list? ly:music?) (_i "Define parallel music sequences, separated by '|' (bar check signs), and assign them to the identifiers provided in @var{voice-ids}. @@ -1055,6 +1055,11 @@ unfoldRepeats = as @code{\\repeat unfold}.") (unfold-repeats music)) +void = +#(define-void-function (parser location arg) (scheme?) + (_i "Accept a scheme argument, return a void expression. +Use this if you want to have a scheme expression evaluated +because of its side-effects, but its value ignored.")) withMusicProperty = diff --git a/scm/music-functions.scm b/scm/music-functions.scm index be4d62e438..bfec250992 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -850,6 +850,14 @@ parameter." `(define-syntax-function scheme? ,@rest)) +(defmacro-public define-void-function rest + "This defines a Scheme function like @code{define-scheme-function} with +void return value (i.e., what most Guile functions with `unspecified' +value return). Use this when defining functions for executing actions +rather than returning values, to keep Lilypond from trying to interpret +the return value." + `(define-syntax-function void? ,@rest #f (begin))) + (defmacro-public define-event-function rest "Defining macro returning event functions. Syntax: