Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread Jan-Peter Voigt

Hi Urs,

Am 24.05.2018 um 12:29 schrieb Urs Liska:
...


Well, with the above changes (where the first was a real issue of 
understanding and the other two just glitches) the MWE works as 
expected. Unfortunately it doesn't seem to work in the real-world 
context. The log still only reports the creation of Score contexts. I'm 
now using

     (list 'assign 'edition-id (list 'ICEID part))
to insert the edition-id (where part is a symbol identifying the current 
part).

The log reports
     (masses three kyrie Score A) ""
lines for each of the movements(scores).

...

in you MWE you assigned the Score-editionID in a global layout block. If 
you there are multiple scores in one compilation they will all receive 
the same editionID. You can either use \new Score \with { \editionID 
movmtpath } or use a layout-block inside: \score{ \layout { \editionID 
... } }. Though I have once tested the second pattern - it should work - 
but I have only tested the first one.


You know that I use my own templating framework 
(https://github.com/openlilylib/lalily-templates). There is a lot of 
code dealing with those issues.


HTH
Jan-Peter

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


Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread Urs Liska

Hi Jan-Peter,

thanks for the clarifications.


Am 24.05.2018 um 12:05 schrieb Jan-Peter Voigt:

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.


OK, I wasn't really clear about that.

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.


Yes, I had noticed that too in the meantime.

3. In your MWE you add the editionID to the Staff and not the Score. 
So you can't address compile.with.Score here.


Oh. Stupid mistake.



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
  }
}
%%%


Well, with the above changes (where the first was a real issue of 
understanding and the other two just glitches) the MWE works as 
expected. Unfortunately it doesn't seem to work in the real-world 
context. The log still only reports the creation of Score contexts. I'm 
now using

    (list 'assign 'edition-id (list 'ICEID part))
to insert the edition-id (where part is a symbol identifying the current 
part).

The log reports
    (masses three kyrie Score A) ""
lines for each of the movements(scores).



BTW you should reconsider using #{ ... #}. It is semantically the same 
and is much easier to read.


Hm, this is part of a pretty complex structure where I have come to find 
the nesting and referencing of Scheme procedures pretty adequate (see 
https://git.openlilylib.org/bfsc/kayser/blob/master/includes/lib/make-staff.ily#L132 
for the state prior to my current attempts).


Best
Urs



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 

Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread Jan-Peter Voigt

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
 

Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread arnepe
hi Urs,

how about Voice or Score without ".A" - if applicable?
If I copy/paste your examples into oner of my own test MWE's this makes the
difference ...

cheers
Arne



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread 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


Programmatically inject an \editionID in a staff

2018-05-24 Thread 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