[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: upgrading a songbook from 2.14 to 2.18
From: |
Maurits Lamers |
Subject: |
Re: upgrading a songbook from 2.14 to 2.18 |
Date: |
Wed, 2 Sep 2020 21:21:28 +0200 |
Hi,
> Op 2 sep. 2020, om 21:07 heeft David Kastrup <dak@gnu.org> het volgende
> geschreven:
>
> Maurits Lamers <maurits@weidestraat.nl> writes:
>
>> Hi,
>>
>>> convert-ly does text replacements. It is not a full parser. If text
>>> replacements are supposed to work, you need to write your text in a way
>>> that the replacement patterns cover. Stuff like putting # on one line
>>> and a corresponding opening paren on the next line are just too weird
>>> for those writing the conversion rules to have foreseen.
>>>
>>> So first try formatting your source in a somewhat common manner and then
>>> try running convert-ly.
>>
>> I did notice this way of indenting though and changed it before
>> running Lilypond, but I didn't anticipate that convert-ly would also
>> check for scheme code patterns.
>
> It doesn't "check" for style. It catches some patterns and converts
> them and overlooks others.
>
> The 2.14 to 2.16 upgrade overhauled # syntax significantly, changed the
> meaning of $ for LilyPond, changed the meaning of $ in embedded Scheme
> inside of #{ #}, replaced #(ly:export ...) with $... and a few other
> comparatively invasive things, all using regular expressions.
>
> It did a pretty good job on LilyPond's own code base formatted in
> LilyPond's own style, but things like #<some whitespace> or
> #(<some whitespace> are so unusual that they have not made it into the
> patterns.
There is indeed only so much that can be caught.
I now got things to work, so thanks a lot!
There is one little thing you might know the answer to. I referred earlier to
this alignGrob code which came from the lilypond-user mailing list.
This function is defined like this:
alignGrob = #(define-music-function (parser location grob-to-align
reference-grob dir corr) (string? symbol? integer? number?)
#{
\overrideProperty $grob-to-align #'after-line-breaking #(lambda (grob)
and called like this:
\alignGrob "Score.RehearsalMark" #'StaffSymbol #1 #0
It ran into an error, telling that Score.RehearsalMark was an invalid property
path.
So, I made a test file with the following line: \overrideProperty
Score.RehearsalMark #'after-line-breaking #(lambda (grob) )
and ran this through convert-ly, which resulted in this line being rewritten as
\overrideProperty Score.RehearsalMark.after-line-breaking.
I managed to that the alignGrob function working by replacing
#'after-line-breaking with .after-line-breaking, but I had to leave a space
between $grob-to-align and .after-line-breaking.
After replacing this, I ran a file successfully, so that seems to work as
required.
Two questions about this though:
1. is this space inbetween going to cause any trouble in the future?
2. is there another way to insert the $grob-to-align string where the space
doesn't have to be there?
cheers and thanks!
Maurits