%LSR based on %LSR https://stackoverflow.com/questions/40964806/scheme-inserting-a-number-in-a-list #(define (insert-before where what lst) (cond ((null? lst) ; If the list is empty, (list what)) ; return a single-element list. ((eq? where (car lst)) ; If we find symbol `where`, (cons what lst)) ; insert `what` before curr. position. (else ; Otherwise keep building the list by (cons (car lst) ; adding the current element and ; recursing with the next element. (insert-before where what (cdr lst)))))) cancellationFirst = \override Score.BreakAlignment.break-align-orders = #(grob-transformer 'break-align-orders (lambda (grob orig) (let* ((middle (vector-ref orig 1)) (middle (delq 'key-cancellation middle)) (middle (insert-before 'staff-bar 'key-cancellation middle))) (vector ;; end of line (vector-ref orig 0) ;; middle of line middle ;; beginning of line (vector-ref orig 2))))) music = { \key es \major d'1 \bar "||" \key a \major d'1 } { <>^\markup "default" \music } { <>^\markup "cancellation first" \cancellationFirst \music } \paper { tagline = ##f }