Hi Urs,
here we have three problems:
1. The symbol 'ICEID is a magic token to inherit the edition-id of the
parent context, so you don't need to add the base path here.
2. \editionID creates a symbol-list, but the name is a string, so you
have to turn it into a symbol, if you want to use it there.
3. In your MWE you add the editionID to the Staff and not the Score. So
you can't address compile.with.Score here.
I quickly adapted your example:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.80"
\include "oll-core/package.ily"
\loadPackage edition-engraver
\consistToContexts #edition-engraver Score.Staff.Voice
\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff \once \override
NoteHead.color = #red
\editionMod part 1 1/4 compile.with.Score \once \override NoteHead.color
= #red
makeStaff =
#(define-music-function (name content)(string? ly:music?)
;#{
; \new Staff = $name \with { \editionID #(list (string->symbol
name)) } { #content }
;#})
% {
(make-music
'ContextSpeccedMusic 'create-new #t
'property-operations
(list
(list 'assign 'edition-id (list 'ICEID (string->symbol name))) )
'context-id name 'context-type 'Staff
'element content))
%}
\displayMusic \makeStaff "hello-staff" { c' d' }
\layout {
\context {
\Score
\editionID ##f compile.with
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BTW you should reconsider using #{ ... #}. It is semantically the same
and is much easier to read.
HTH
Jan-Peter
Am 24.05.2018 um 11:35 schrieb Urs Liska:
This is a -- similar -- MWE:
\version "2.19.80"
\include "oll-core/package.ily"
\loadPackage edition-engraver
\consistToContexts #edition-engraver Score.Staff.Voice
makeStaff =
#(define-music-function (name content)(string? ly:music?)
(make-music
'ContextSpeccedMusic 'create-new #t
'property-operations
(list
(list 'assign 'edition-id (append '(ICEID compile with) (list
name))))
'context-id name 'context-type 'Staff
'element content))
\makeStaff "hello-staff" { c' d' }
\layout {
\context {
\Staff
\editionID ##f compile.with
}
}
\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff.A \once \override
NoteHead.color = #red
\editionMod part 1 0/4 compile.with.Score.A \once \override
NoteHead.color = #red
However, in this case it seems *both* mods won't have any effect ...
Urs
Am 24.05.2018 um 11:17 schrieb Urs Liska:
I'm trying to "install" the edition engraver in a programmatically
generated score construction.
I have this code somewhere in the function to create a score:
(ly:score-add-output-def! score
#{
\layout {
\context {
\Score
#(editionID #f movement-path)
}
}
#})
where movement-path is a symbol list identifying the current
movement's score, e.g. #'(masses three kyrie)
I know this is working because the page-layout openLilyLib package
properly uses that successfully. So I know each score has its own
edition-id.
Now in order to make it possible to use \editionMod and friends I need
to add the \editionID to each staff. I tested
\displayMusic
\new Staff \with { \editionID test } { c' }
and got
(make-music
'ContextSpeccedMusic
'create-new
#t
'property-operations
(list (list 'assign
'edition-id
(list (quote ICEID) (quote test))))
'context-type
'Staff
'element
(make-music
'SequentialMusic
'elements
(list (make-music
'NoteEvent
'pitch
(ly:make-pitch 0 0)
'duration
(ly:make-duration 2)))))
as a result.
So I thought I could inject the edition-id simply with
(list 'assign 'edition-id (append (list 'ICEID) path))
with 'path' being e.g. #'(masses three kyrie violin-one)
This is the current version of that (sub-)function:
;; Create a named Staff context with the appropriate
;; context modifications.
;; content is a variable number of music expressions
(make-staff
(lambda (name . content)
(make-music
'ContextSpeccedMusic 'create-new #t
'property-operations
(list
(list 'assign 'edition-id (append (list 'ICEID) path))
(list 'assign 'instrumentName (car instrument-names))
(list 'assign 'shortInstrumentName (cdr
instrument-names))
(list 'assign 'midiInstrument
(getOption `(kayser instruments ,base-part
midi-instrument)))
(list 'assign 'instrumentTransposition
transposition-from)
frenched-score
lyric-mods)
'context-id name 'context-type 'Staff
'element (make-simultaneous-music content))))
This works without warnings or errors but doesn't seem to work.
\addEdition part
\editionMod part 1 0/4 masses.three.kyrie.violin-one.Voice.A \once
\override NoteHead.color = #red
\editionMod part 2 0/4 masses.three.kyrie.Score.A \once \override
NoteHead.color = #red
Here only the second mod is applied (the one to Score.A), the mod to
violin-one.Voice.A is ignored.
This is somewhat in line with the edition.log file which only reports a
(masses three kyrie Score A) ""
context.
Does this information give any indication what I might be doing wrong?
If I look at the definition of \editionID it doesn't give me any
further hints.
TIA
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user