From 6248ccd867bb2bb58faf6f98a42e6f34c485a8e7 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sun, 7 Oct 2012 10:22:55 +0200 Subject: [PATCH] Let \accidentalStyle detect its optional context argument by looking at its letter case This is a fishy stopgap measure to let \accidentalStyle able to distinguish #'Voice "default" from "default" alone while we generate symbols from from #'Voice as well as "default". If the first letter is uppercase, the symbol is considered to be a context specification. --- ly/property-init.ly | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ly/property-init.ly b/ly/property-init.ly index 269648639b..fd9c2f337a 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -13,10 +13,16 @@ 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) ((symbol?) string?) + (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 -- 2.39.2