On Wed, 2026-08-12 at 10:37 +0200, Lukas-Fabian Moser wrote:
> Hi Richard,
> 
> > In running convert.ly from version 2.26.0 on a file that compiles
> > with
> > 2.24.0 I get a change in name from ly:duration-length to
> > ly:duration-
> > moment. But the typesetting is completely different. The code
> > concerned
> > is a definition to allow setting the spacing in a graceAfter grace
> > note. Here is the MWE
> 
> Could you please provide the original, working (with an older
> LilyPond 
> version) state of your code before convert-ly changed it?
Thank you for getting back to me:

This is the code working in 2.24

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.24"

attachGraces = #(define-music-function (parser location frac note graces) 
(number? ly:music? ly:music?)
 (if (null? (ly:music-property graces 'element))
         (begin
          (ly:warning "No grace notes follow this note the afterGrace will be 
ignored.")
          (make-music
                  'SequentialMusic 
                  'elements
                  (list note graces)))
          ;(make-music 'Music 'void #t))
         (let ((skip (* frac (/ (ly:moment-main-numerator (ly:duration-length 
(ly:music-property note 'duration)))
                  (ly:moment-main-denominator (ly:duration-length 
(ly:music-property note 'duration))))))
           (thegraces  (ly:music-property (list-ref (ly:music-property 
                                         (ly:music-property graces 'element) 
'elements) 1) 'elements)))
        (define gracenotes (make-music 'GraceMusic 'element (make-music
                        'SequentialMusic
                        'elements
                        thegraces)))
           (make-music
                  'SimultaneousMusic 
                  'elements
                  (list
                 note 
                (make-music
                 'SequentialMusic
                  'elements
                  (list
                         (make-music
                                  'SkipMusic
                                  'duration
                                  (ly:make-duration 0 0 skip))
                                gracenotes)))))))



\score { 
          \new Staff
          << { \attachGraces #3/4 g''4 \grace {f''8} } >>
       } 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




>  The code is a 
> bit opaque and doesn't seem to be written very robustly (what with
> the 
> hardcoded nested 'element / 'elements selection);

I'm afraid I've lost track of where the code came from - I couldn't
have written it myself, but I can't see it appearing in the mailing
lists. Be that as it may the converted code 2.24->2.26 then shows no
grace note at all on typesetting with 2.26

Here is the converted code given by 2.26 convert-ly

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\version "2.26.0"

attachGraces = #(define-music-function (parser location frac note
graces) (number? ly:music? ly:music?)
 (if (null? (ly:music-property graces 'element))
         (begin
          (ly:warning "No grace notes follow this note the afterGrace
will be ignored.")
          (make-music
                  'SequentialMusic 
                  'elements
                  (list note graces)))
          ;(make-music 'Music 'void #t))
         (let ((skip (* frac (/ (ly:moment-main-numerator
(ly:duration->moment (ly:music-property note 'duration)))
                  (ly:moment-main-denominator (ly:duration->moment
(ly:music-property note 'duration))))))
           (thegraces  (ly:music-property (list-ref (ly:music-property
                                         (ly:music-property graces
'element) 'elements) 1) 'elements)))
        (define gracenotes (make-music 'GraceMusic 'element (make-
music
                        'SequentialMusic
                        'elements
                        thegraces)))
           (make-music
                  'SimultaneousMusic 
                  'elements
                  (list
                 note 
                (make-music
                 'SequentialMusic
                  'elements
                  (list
                         (make-music
                                  'SkipMusic
                                  'duration
                                  (ly:make-duration 0 0 skip))
                                gracenotes)))))))



\score { 
          \new Staff
          << { \attachGraces #3/4 g''4 \grace {f''8} } >>
       } 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The aim of the code is to allow the user an easy control of how much
spacing from the (preceding) main note a graceAfter has.
Thank you very much for responding.

Richard




Reply via email to