Dear all,

I am trying extend Lilypond in Scheme to add a new accidental
style. What I am currently stuck on is how to add a new item to the
"accidental-styles" alist in such a way that it is visible to the
\accidentalStyle command.

I have a file called "hist-accidentals.scm" that contains the following:

> (define-public (hist-accidental-rule context pitch barnum measurepos)
>   "An accidental rule that only typesets sharps and flats, indicating
>   relative alteration compared to the key signature."
>   (let* ((keysig (ly:context-property context 'localAlterations))
>   (entry (find-pitch-entry keysig pitch #t #t)))
>   (if (not entry)
>   (cons #f #f)
>   (let* ((global-entry (find-pitch-entry keysig pitch #f #f))
>   (key-acc (key-entry-alteration global-entry))
>   (acc (ly:pitch-alteration pitch))
>   (entrymp (key-entry-measure-position entry))
>   (entrybn (key-entry-bar-number entry)))
>   (cons #f (not (or (equal? acc key-acc)
>                               (and (equal? entrybn barnum) (equal?
>                               entrymp measurepos)))))))))
> 
> (set! accidental-styles
> (cons hist #f
> (Staff ,(make-accidental-rule 'same-octave 0))
> (Staff ,(make-accidental-rule 'same-octave 1)
> hist-accidental-rule)))
> accidental-styles))

(currently the contents of "hist-accidental-rule" is just a copy of the
"teaching" accidental style)

At the top of the relevant lilypond file, I load the scheme file with

> #(load "hist-accidentals.scm")

But when I come to write

> \accidentalStyle hist

later on, lilypond complains with "warning: unknown accidental style:
hist". How do I modify variables defined using "define-public"? Or, what
should I be doing instead?

Thanks,
Edward



-- 

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to