[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: music-to-markup
From: |
David Kastrup |
Subject: |
Re: music-to-markup |
Date: |
Fri, 25 Jul 2014 10:24:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Urs Liska <address@hidden> writes:
> Am 23.07.2014 21:54, schrieb Urs Liska:
>
>> So you mean I should parse this (example result):
>> (/tmp/frescobaldi-4Orug3/tmp8Y5V5X/document.ly 8 0 16 1)
>>
>> open the file (separately) from Scheme and read the given range?
>> You're right, that looks somewhat awkward but whould give me a start.
>>
>> Thanks
>> Urs
>
>
> I think "give me a start" was quite right.
>
> Scheme so often makes me feel stupid. Now I manage to open the file
> but I don't have any clue as to how to make its content available for
> processing. I'd think I'd read it line by line, discarding the leading
> and trailing lines outside the range, but I didn't manage to do
> anything so far.
See, this is where my large programming and LilyPond experience gives me
an advantage over you. Instead of coming to the conclusion "I must be
stupid" I come to the conclusion "this is stupid".
You can get the whole file as a single string with ly:gulp-file. Or you
can nest with-output-to-string and with-input-from-file (or what it was
called) in a loop, read stuff in and write it out when the current input
line/file number is in the indicated range. Which sounds somewhat
suboptimal, particularly considering that you'll be redoing this for
every file.
I think I'll try cooking up some sort of Scheme function for extracting
the text corresponding to a location pair and put it into LilyPond
proper.
That will not help you now, but it might come in handy in future.
--
David Kastrup