Am So., 13. Nov. 2022 um 16:30 Uhr schrieb Jean Abou Samra <j...@abou-samra.fr>: > > > > > Le 13 nov. 2022 à 16:22, Thomas Morley <thomasmorle...@gmail.com> a écrit : > > > > Nevertheless, _if_ the old code is just (markup->string > > <whatever-markup>), would it be possible to leave it untouched while > > running convert-ly? After all it continues to work with 2.23. in this > > simple manor, only inserting a more complex expression, if the old > > code already has an optional argument? > > Can't check myself, my python is as non-existent as my C++ ... > > > How do you know if the old code does not use the optional argument? It could > be any Scheme expression, or even a #{ … #} expression. Scheme has more > syntax than one might think: there could be ; or #! or #| comments and all > sorts of things. > > One could special-case (markup->string <symbol>), catching a subset of those > cases. I’m not bothered by the current replacement, but would that make you > happier? In any case, we can’t reliably detect all cases of markup->string > applies to one argument only. > > Jean
Well, I have to admit I can't follow. In my understanding the old markup->string has one or more arguments, the first must be of type markup. Obviously my understanding is not entirely correct. Nevertheless the insertion done by convert-ly is not nice, imho. As a mere user I'd think some bug happened. Would it be feasable to do a type-checking for `headers' in `headers-property-alist-chain'? At least one could eliminate the (if ...) in the convert-rule. Something at the lines of: (define-public (headers-property-alist-chain headers) "Take a list of @code{\\header} blocks (Guile modules). Return an alist chain containing all of their bindings where the names have been prefixed with @code{header:}. This alist chain is suitable for interpreting a markup in the context of these headers." (map (lambda (module) (map (lambda (entry) (cons (string->symbol (string-append "header:" (symbol->string (car entry)))) (cdr entry))) (ly:module->alist module))) (or headers '()))) ^^^^^^^^^^^^^^^^^ Or if this to bold/optimistic: (if (list? headers) headers '()) Cheers, Harm