Modify only the current system: Difference between revisions
Appearance
Import snippet from LSR |
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
||
| Line 1: | Line 1: | ||
Starting bars usually are all clones of the first one. The only way to affect one system and not the others is to collect all the grobs using the <code>all-elements</code> property of any grob on the system in question (for example a <code>NoteHead</code>) and filter the target grob, which you can then modify. | Starting bars usually are all clones of the first one. The only way to affect one system and not the others is to collect all the grobs using the <code>all-elements</code> property of any grob on the system in question (for example a <code>NoteHead</code>) and filter the target grob, which you can then modify. | ||
<lilypond version="2.24 | <lilypond version="2.24" full> | ||
%% Thanks to David Nalesnik: | %% Thanks to David Nalesnik: | ||
%% https://lists.gnu.org/archive/html/lilypond-user/2019-03/msg00205.html | %% https://lists.gnu.org/archive/html/lilypond-user/2019-03/msg00205.html | ||
Revision as of 18:54, 16 November 2025
Starting bars usually are all clones of the first one. The only way to affect one system and not the others is to collect all the grobs using the all-elements property of any grob on the system in question (for example a NoteHead) and filter the target grob, which you can then modify.
\version "2.24"
%% Thanks to David Nalesnik:
%% https://lists.gnu.org/archive/html/lilypond-user/2019-03/msg00205.html
#(define drop-in-on-spanner
(lambda (grob)
(let* ((elts (ly:grob-array->list (ly:grob-object (ly:grob-system grob) 'all-elements)))
(ssb (filter (lambda (e) (grob::has-interface e 'system-start-delimiter-interface))
elts)))
(set! (ly:grob-property (car ssb) 'color) red))))
\new StaffGroup <<
\new Staff {
c'1 \break
\tweak after-line-breaking #drop-in-on-spanner
c' \break
c' \break
}
\new Staff {
c' c' c'
}
>>
\paper { tagline = ##f }