Re: Modify ly:duration->string
Thomas Morley <[email protected]> Mon, 11 May 2026 00:20:39 +0200
| Newsgroups | gmane.comp.gnu.lilypond.devel |
|---|---|
| Message-ID | <CABsfGyXzJ4jLgg=X5hHzGLRsVApDp_B6wwpg53PwHs+nWrNXsw@mail.gmail.com> |
Am So., 10. Mai 2026 um 13:37 Uhr schrieb Lukas-Fabian Moser <[email protected]>: > > Hi Harm, > > Am 10.05.26 um 12:36 schrieb Thomas Morley: > > consider the following: > > #(pretty-print (ly:duration->string (ly:make-duration -3))) > > returning: > > "log = -3" > > > > Is it possible to let it return "maxima" (similar for "longa", "breve")? > > To be more precise, this is a request to modify ly:duration->string (I > > have already some clumsy custom code to deal with negative durations). > > Of course it's basically no problem to make this change (I assume it's > the fact that ly:duration->string is implemented in C++ that makes you > ask this question in the first place). Indeed. > But I have a slight issue with that: One might hard-code > ly:duration->string to output > > \maxima > > etc. (which I'd prefer to 'maxima', since all other duration strings > returned by the function are valid LilyPond syntax). Well, { b$breve } is valid syntax as well, so "breve" would not be that bad. No strong prefernences here. though. > But "maxima" is not a term that's baked into the C++ part of LilyPond, > but it's a (so to speak) arbitrary definition in > ly/declarations-init.ly. It would, at first glance, feel strange to me > to implement this term unconditionally in the C++ code as a return > string for ly:duration->string ... > > What do you think? > > Lukas > Dan pointed to `duration->lily-string`, which is indeed the better choice for me. There "\\breve" etc would be returned, hard-coded as well. Thanks, Harm