I changed your suggestion to a function (I've no problems using a function in this case) and tested both:
1. It doesn't works with "2.14.2", but with "2.15.13" there are no problems.
Does it work with "2.14.2" for you?
2. Using it with \change Staff doesn't work! Maybe an issue with \change Staff?
\version "2.15.13"
xy = \once\override Stem #'french-beaming = ##t
#(define ((stem-length y) grob)
(ly:grob-set-property! grob 'length y)
(ly:stem::print grob))
xyOut =
#(define-music-function (parser location y-length)(number?)
#{
\once \override Stem #'stencil = #(stem-length $y-length)
#})
% This works
\relative c {
\once \override Beam #'stencil = #(grow-beam-var 5)
f32 [ \xy f''' f,,, \xy f''' f,,, \xy f''' f,,, \xy f''' f,,,
\xyOut #11
f''']
}
% This not. Issue in \change Staff ?
top = \change Staff = "1"
bottom = \change Staff = "2"
music = \relative c {
\override Beam #'auto-knee-gap = #0
\override Beam #'stencil = #(grow-beam-var 1)
\bottom cis32[
f
%\xyOut #0
\once \override Stem #'stencil = #(lambda (grob) (ly:grob-set-property! grob 'length 0)
(ly:stem::print grob))
\top f'']
}
\score {
\new PianoStaff <<
\new Staff = "1" {
s16.
}
\new Staff = "2" {
\clef bass
\music
}
>>
}