Indeed it does, thank you. And no, my Scheme would _not_ have been up to that. I was still trying to figure out how to access the value of line-width, or indeed any of the \paper variables: the documentation is very clear on how to set them in the \paper block, but completely unforthcoming on how to get them from anywhere else.
I'm glad I could help! The documentation does mention how to access these properties in a custom markup command
but I wasn't sure how to pass layout info to it in other situations. (I ended up doing a search for examples of ly:output-def-lookup in code.)
In fact, even given your solution I'm not convinced I understand how it works: as far as I can see you have defined an anonymous function, but not actually evaluated it ... (I've been coding on and off for 30 years in a succession of Basic, Fortran, C, Matlab, C++, Python and even the odd spot of assembler, but Scheme remains quite impenetrable to me).
I'm definitely not the one to give explanations! I look at some examples of tail-recursion and wonder and wonder at how they get this result and not another, or do anything at all -- it's still all very opaque to me . . . (But having a program like LilyPond make it so rewarding for me to pick up whatever I can.)
Best,
David