% Your own madrigal accidental rule... #(define-public (my-madrigal-accidental-rule context pitch barnum measurepos) "Here comes the description. This style is an exact copy of teaching-accidental-rule and needs to be adjusted. Original description: an accidental rule that typesets a cautionary accidental if it is included in the key signature AND does not directly follow a note on the same staff-line." (let* ((keysig (ly:context-property context 'localKeySignature)) (entry (find-pitch-entry keysig pitch #t #t))) (if (equal? #f entry) (cons #f #f) (let* ((global-entry (find-pitch-entry keysig pitch #f #f)) (key-acc (if (equal? global-entry #f) 0 (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))))))))) \relative c' { \key es \major % #(set-accidental-style 'teaching) % is the same as the following. #(ly:export (set-accidentals-properties #f ; automatic accidental rule: `(Staff ,(make-accidental-rule 'same-octave 0)) ; cautionary accidental rule: (might want to put this to auto-acc and set cautionaries to '() ??) `(Staff ,(make-accidental-rule 'same-octave 1) ,my-madrigal-accidental-rule) 'Staff)) es es g e es g es e | }