Am Mi., 20. Juli 2022 um 18:43 Uhr schrieb Martín Rincón Botero <
martinrinconbot...@gmail.com>:

> Hello,
>
> I grabbed this snippet a while ago from somewhere™ which puts a box
> around music (an "improvisation box"). It works perfectly in Lilypond
> 2.22.1, but not in Lilypond 2.23.3+. Does somebody know how to make it work
> in more recent versions? This is the snippet:
>

Probably better and more inline with what's done internally, let the
classes-entry be done automatically:

#(define (add-grob-definition grob-name grob-entry)
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
          (class        (assoc-get 'class meta-entry))
          (ifaces-entry (assoc-get 'interfaces meta-entry)))
     ;; change ly:grob-properties? to list? to work from 2.19.12 back to at
least 2.18.2
     (set-object-property! grob-name 'translation-type? ly:grob-properties?)
     (set-object-property! grob-name 'is-grob? #t)
     (set! ifaces-entry (append (case class
                                  ((Item) '(item-interface))
                                  ((Spanner) '(spanner-interface))
                                  ((Paper_column) '((item-interface

 paper-column-interface)))
                                  ((System) '((system-interface
                                               spanner-interface)))
                                  (else '(unknown-interface)))
                          ifaces-entry))
     (set! ifaces-entry (uniq-list (sort ifaces-entry symbol<?)))
     (set! ifaces-entry (cons 'grob-interface ifaces-entry))
;; add:
     (set! meta-entry (assoc-set! meta-entry 'classes (list class)))
     (set! meta-entry (assoc-set! meta-entry 'name grob-name))
     (set! meta-entry (assoc-set! meta-entry 'interfaces
                        ifaces-entry))
     (set! grob-entry (assoc-set! grob-entry 'meta meta-entry))
     (set! all-grob-descriptions
           (cons (cons grob-name grob-entry)
             all-grob-descriptions))))

HTH,
  Harm

Reply via email to