]> git.donarmstrong.com Git - lilypond.git/commitdiff
Change \accidentalStyle to get a symbol list as argument
authorDavid Kastrup <dak@gnu.org>
Mon, 8 Oct 2012 19:28:27 +0000 (21:28 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 25 Oct 2012 18:29:28 +0000 (20:29 +0200)
This changes the syntax of \accidentalStyle to accept specs like
Voice.piano-cautionary .

ly/property-init.ly

index d88559d26408374a702ff9981e9110d63fda53e1..40aa869de88f0b656b7662ddb3eaa4f18aa64120 100644 (file)
@@ -13,24 +13,21 @@ defaultNoteHeads =
    (_i "Revert to the default note head style.")
    (revert-head-style '(NoteHead TabNoteHead)))
 
-#(define (context-name? c)
-  "A stopgap measure until dotted lists become available as arguments.
-Distinguish context names from accidental styles by virtue of their
-first letter being uppercase."
-  (and (symbol? c)
-   (char-upper-case? (string-ref (symbol->string c) 0))))
-
 accidentalStyle =
 #(define-music-function
-   (parser location context style) ((context-name?) string?)
-   (_i "Set accidental style to @var{style}, a string.  If an optional
-@var{context} symbol is given, e.g. @code{#'Staff} or @code{#'Voice},
-the settings are applied to that context.  Otherwise, the context
-defaults to @samp{Staff}, except for piano styles, which use
-@samp{GrandStaff} as a context." )
-   (if context
-       (set-accidental-style (string->symbol style) context)
-       (set-accidental-style (string->symbol style))))
+   (parser location style) (symbol-list?)
+   (_i "Set accidental style to symbol list @var{style} in the form
+@samp{piano-cautionary}.  If @var{style} has a form like
+@samp{Staff.piano-cautionary}, the settings are applied to that
+context.  Otherwise, the context defaults to @samp{Staff}, except for
+piano styles, which use @samp{GrandStaff} as a context." )
+   (case (length style)
+    ((1) (set-accidental-style (car style)))
+    ((2) (set-accidental-style (cadr style) (car style)))
+    (else
+     (ly:parser-error parser (_ "not an accidental style")
+      location)
+     (make-music 'Music))))
 
 %% arpeggios